简体   繁体   English

带有Fluent Nhibernate的Oracle 12c Identity列

[英]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.

相关问题 为什么在 Oracle 数据库 12c 上出现此错误? - Why do I get this error on Oracle Database 12c? 如何从SQL Server获取到Oracle 12c的日期? 日期正在倒转(向后) - How can I get a date from SQL Server into Oracle 12c? Dates are being inverted (backwards) 实体框架代码优先和Oracle ODAC 12c第3版错误 - Entity Framework Code First and Oracle ODAC 12c Release 3 Error Azure SQL V12的最佳流利NHibernate配置? - Best fluent NHibernate configuration for Azure SQL V12? 使用Fluent NHibernate进行非主键Identity AutoIncrement Mapping - Non primary key Identity AutoIncrement Mapping using Fluent NHibernate 流畅的NHibernate - HasManyToMany NHibernate.MappingException:映射中的重复列集合 - Fluent NHibernate - HasManyToMany NHibernate.MappingException: Repeated column in mapping for collection 流利的NHibernate将一列映射到两列之一 - Fluent NHibernate Mapping a column against one of two columns 流利的NHibernate:如何使用约定为组件中的引用指定列名? - Fluent NHibernate: how to specify column name for reference in component using conventions? 流利的NHibernate:如何将db整数映射到datetime列? - Fluent NHibernate: How to map a db integer to a datetime column? 流畅的NHibernate映射IList <Point> 作为单列的值 - Fluent NHibernate mapping IList<Point> as value to single column
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM