views:

326

answers:

4

I posted the question in the Fluent-NHibernate newgroup but so far there has been no answer from the void.

Is there a Fluent NHibernate mapping for the NHibernate "trigger-identity" method of generating primary keys.

Thanks

A: 

So it turns out that trigger-identity is not currently supported.

Dave
+2  A: 

You can use this.Id(x => x.Id).Column("ID").GeneratedBy.Custom("trigger-identity");

dRn
tried this with Fluent build 636 and it works (need this for my project, too)
devio
A: 

Hi dRn sorry didn't work for me got the following innerException :

{"Could not interpret id generator strategy: XXXXXX"}

I am currently using a sequence ".GeneratedBy.Native("MY_SEQUENCE")"

However i would like to have sequences incremented by the trigger (which has to fire on inserts for me anyway).

Cheers.

ODP.net / Oracle 10.2.0.4 OCT09 CPU / Windows 2003 - 32bit / Fluent NHibernate 1.0 / NHibernate 2.1.2.GA / VS2008 SP1 / .net 3.5

PaRa
try Fluent build 636
devio
A: 

So far, the only solution I've found is to use an hbm.xml file for those entities that require trigger-identity generators. However, we ran into another problem when using trigger-identity and "long" ids and our Oracle database . There is a bug where NHibernate does not translate the Id values returned from properly. Here is the JIRA entry:

http://216.121.112.228/browse/NH-1893?page=com.atlassian.streams.streams-jira-plugin%3Aactivity-stream-issue-tab

Dave

related questions