[英]Oracle 12c Identity column with Fluent Nhibernate
Recently my application database was updated to use Oracle 12c so in the creation of new tables I have used the new identity feature: 最近,我的应用程序数据库已更新为使用Oracle 12c,因此在创建新表时,我使用了新的标识功能:
ID NUMBER GENERATED ALWAYS AS IDENTITY,
Within my Fluent mapping I have configured: 在我的Fluent映射中,我已配置:
Id(x => x.Id).Column("ID").GeneratedBy.Identity();
However when trying to save a new record I'm getting the following error: 但是,当尝试保存新记录时,出现以下错误:
NHibernate.Exceptions.GenericADOException: could not insert: [Entity][SQL: INSERT INTO TABLE (ID, AFFECTED_ID, AFFECTED_TYPE, ACTION_TYPE, ACTION_OWNER, ENTITY_ID, ACTION_TIMESTAMP) VALUES (hibernate_sequence.nextval, ?, ?, ?, ?, ?, ?) returning ID into :nhIdOutParam] ---> Oracle.DataAccess.Client.OracleException: ORA-02289: sequence does not exist
NHibernate.Exceptions.GenericADOException:无法插入:[Entity] [SQL:插入表(ID,AFFECTED_ID,AFFECTED_TYPE,ACTION_TYPE,ACTION_OWNER,ENTITY_ID,ACTION_TIMESTAMP)值(hibernate_sequence.nextval,?,?,?,?,?,? ?)返回ID到:nhIdOutParam] ---> Oracle.DataAccess.Client.OracleException:ORA-02289:序列不存在
I can clearly see that its trying to use a sequence that doesn't exist. 我可以清楚地看到它试图使用不存在的序列。
Looking at the current version of Nhibernate the application is using seems to be out of date: 查看应用程序正在使用的当前版本的Nhibernate似乎已过时:
<package id="NHibernate" version="3.3.2.4000" targetFramework="net45" />
Fluent NHibernate 1.3.0.733
Does Fluent Nhibernate support Oracle 12c Identity feature if so how do I get it to work? 如果可以,Fluent Nhibernate是否支持Oracle 12c Identity功能?
I think you should be able to use 我认为您应该可以使用
Id(x => x.Id).Column("ID").GeneratedBy.SequenceIdentity("Your_Sequence_Name")
Regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.