【问题标题】:Upgrading Nhibernate unable to save large string in SQL Server升级 Nhibernate 无法在 SQL Server 中保存大字符串
【发布时间】:2016-05-31 13:00:40
【问题描述】:

在我们的 dot net 应用程序中将 NHibernate 版本从 2.1.2.4000 升级到 3.3.1.4000。它在以前的版本中存储了将近 9000 个字符的字符串,但在 3.3.1.4000 中它给出了错误。

在 SQL Server 中类型是 ntext 而在 Oracle 中是 nclob 在我们使用的 hbm 文件中

<property name="Value" column ="SettingValue" type="AnsiString"/>

以上代码在两个版本中都适用于 oracle,但不适用于 sql server。 我尝试了 length="10000" 和其他几个选项,但没有用。

【问题讨论】:

  • 我不知道你的问题的答案,但你不应该在 sql server 中使用 ntext。该数据类型自 2005 年以来已被弃用。您应该改用 nvarchar(max)。
  • @SeanLange 因为它是遗留应用程序,但目前我们需要解决这个问题。

标签: .net sql-server oracle nhibernate nhibernate-mapping


【解决方案1】:

MS SQL 服务器映射类型为type="StringClob"

<property name="Value" column ="SettingValue" type="StringClob" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-13
    • 2020-11-13
    • 1970-01-01
    • 2016-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多