zoukankan      html  css  js  c++  java
  • 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)");
  • 相关阅读:
    软工第1次阅读作业
    软工第0次作业
    第四次博客
    第三次博客
    第二次
    第一次博客
    提问回顾与个人总结
    软件工程结对作业
    软件工程第一次阅读作业
    软件工程第0次个人作业
  • 原文地址:https://www.cnblogs.com/vincentDr/p/3683348.html
Copyright © 2011-2022 走看看