The length of the string value exceeds the length configured in the mapping/parameter.

在NHibernate 3.3 中存储的字符串太长,会抛异常:The length of the string value exceeds the length configured in the mapping/parameter.

有人会说这是新版NHibernate的一个Bug,3.2就不会出现这样的情况。实际上,对于string类型的属性值,NHibernate默认值最大值是4000个字符,在3.2中会自动截断,在3.3中会给你抛一个异常出来,所以这并不是一个Bug,如果你想存储超过4000个字符的字符串,请在映射文件中修改该属性的类型,使用 type="StringClob" 

<property name="myProp" column="MY_PROP" not-null="true" type="StringClob" access="property"></property>  

Or

Map(x => x.Description).CustomType("StringClob").CustomSqlType("nvarchar(max)");

 

The length of the string value exceeds the length configured in the mapping/parameter.,布布扣,bubuko.com

The length of the string value exceeds the length configured in the mapping/parameter.

上一篇:Android源码分析-全面理解Context


下一篇:百度地图android 公交搜索报错,闪退