1
我想用hilo生成器配置NHibernate,但以下配置會拋出GenericADO異常,指出「無法獲取或更新下一個值[SQL:]」 。如果生成器類是「身份」,它按預期工作。配置hilo「無法獲取或更新下一個值[SQL:]」
注意。在使用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>
請問我可以指向一個解釋hilo配置的地方,例如需要在SQL服務器中創建表。 – 2010-11-11 05:52:52
http://nhforge.org/doc/nh/en/index.html#mapping-declaration-id-generator。如果手動創建,則還必須添加具有初始值的行。 – 2010-11-11 11:00:42