配置 hilo“无法获取或更新下一个值[SQL:]”

发布于 2024-10-02 05:15:12 字数 586 浏览 0 评论 0原文

我想将 NHibernate 配置为使用 hilo 生成器,但以下配置会引发 GenericADO 异常,提示“无法获取或更新下一个值 [SQL: ]”。如果生成器类是“identity”,它将按预期工作。

笔记。使用 hilo 生成器时,我在 SQL Server 端将“Is Identity”设置为“No”。

<class name="Model.Session, Domain" table="Session">
  <id name="SessionID" column="SessionId" type="Int32">
    <!--<generator class="identity" />-->
    <generator class="hilo" /
  </id>
  <property name="SessionToken" column="SessionToken" type="String" length="80"/>
  <property name="UserID" column="UserId" type="Int32"/>
</class>

I want to configure NHibernate to with hilo generator, but the following configuration throws a GenericADO exception saying "could not get or update next value[SQL: ]". If the generator class is 'identity' it works as expected.

Note. I set the "Is Identity" to 'No' on the SQL Server end when using the hilo generator.

<class name="Model.Session, Domain" table="Session">
  <id name="SessionID" column="SessionId" type="Int32">
    <!--<generator class="identity" />-->
    <generator class="hilo" /
  </id>
  <property name="SessionToken" column="SessionToken" type="String" length="80"/>
  <property name="UserID" column="UserId" type="Int32"/>
</class>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失退 2024-10-09 05:15:12

NHibernate 用于从服务器获取“低”值的表可能尚未手动或通过模式生成创建。

基本思想是你有两个
组成主键的数字 - a
“高”数和“低”数。一个
客户端基本上可以增加
“高”序列,知道它可以
然后安全地生成密钥
先前“高点”的整个范围
价值与各种“低”
值。

Probably the table that NHibernate uses to get the "low" values from the server has not been created, either manually or by schema generation.

The basic idea is that you have two
numbers to make up a primary key- a
"high" number and a "low" number. A
client can basically increment the
"high" sequence, knowing that it can
then safely generate keys from the
entire range of the previous "high"
value with the variety of "low"
values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文