使用 Fluent NHibernate、Oracle 10g 和 OracleClientConfiguration.Oracle10 映射 clob
我一直在尝试使用 Fluent NHibernate 1.2.0.712 针对 Oracle 10g 映射 clob 字段。我正在使用 System.Data 提供程序,因为它默认可用,并试图避免由于以前的客户端问题而添加对 ODP.Net 的引用。
但是,当我尝试插入具有映射的 clob 属性的实体时,出现错误:
ORA-01461:只能绑定 LONG 值以插入 LONG 列
我尝试通过使用以下约定来修复此问题,并装饰具有 [StringLength(4000)] 的适当属性:
public class StringLengthConvention : AttributePropertyConvention<StringLengthAttribute>
{
protected override void Apply(StringLengthAttribute attribute, IPropertyInstance instance)
{
instance.Length(attribute.MaximumLength);
}
}
这不起作用。
然后我尝试使用“TEXT”、“CLOB”和“clob”值进行以下操作。两者都不起作用:
public class plaparteMappingOverride : IAutoMappingOverride<plaparte>
{
public void Override(AutoMapping<plaparte> mapping)
{
Map(x => x.disposiciones).CustomSqlTypeIs("TEXT");
}
}
除了添加 ODP 作为提供程序之外,还有人对此修复有进一步的建议吗?
I've been trying to map a clob field using Fluent NHibernate 1.2.0.712 against Oracle 10g. I'm using System.Data provider as it's available by default and was trying to avoid adding reference to ODP.Net due to previous client issues.
However, when I try to insert entities with mapped clob properties, I get the error:
ORA-01461: can bind a LONG value only for insert into a LONG column
I've tried to fix this by using the below convention, and decorating the appropriate property with [StringLength(4000)]:
public class StringLengthConvention : AttributePropertyConvention<StringLengthAttribute>
{
protected override void Apply(StringLengthAttribute attribute, IPropertyInstance instance)
{
instance.Length(attribute.MaximumLength);
}
}
This didn't work.
Then I tried the below using "TEXT", "CLOB" and "clob" values. Neither worked:
public class plaparteMappingOverride : IAutoMappingOverride<plaparte>
{
public void Override(AutoMapping<plaparte> mapping)
{
Map(x => x.disposiciones).CustomSqlTypeIs("TEXT");
}
}
Does anyone have further suggestions for this fix other than adding ODP as the provider?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
供将来参考:这篇文章完美地描述了导致此错误的原因以及你如何解决它。
博客文章中提供的解决方案:自定义 NHibernate Oracle 驱动程序:
For future reference: this post perfectly describes what causes this error and how you can solve it.
Solution offered in the blog post: a custom NHibernate Oracle Driver: