Gerdus,
I solved my issue by modifying the insert trigger and adding a null
check on the PK of the new record. If the value is null, the trigger
will grab the next value from the sequence and set it. If not null, I
simply skip setting the value. Then I used the NHib sequence
generation strategy so that NHibernate calls the sequence, sets the
value and executes the insert.

Hope that helps.
martin

On Mar 30, 9:07 am, Gerdus van Zyl <[email protected]> wrote:
> I too need the trigger-identity functionality but for Firebird in my
> case.
>
> On Mar 10, 10:58 pm, smith2martin <[email protected]> wrote:
>
> > I'm using AR latest and Oracle9Dialect with a trigger on my table for
> > sequence-generated IDs.
>
> > NH2.1.0 has added a newtrigger-identitygenerator which provides the
> > ability to return the value of a POID generated by a sequence called
> > from a trigger fired upon insert. In my case, I can't drop / modify
> > the existing insert trigger since it's used by others. Also, the
> > trigger does more than just ID generation.
>
> > Has anyone come up with a nice way to replicate this functionality
> > with AR latest? Looking for any and all ideas. Otherwise, has anyone
> > had success using another generation strategy to accomplish the same?
> > Native and Assigned both work, but I need the generated ID returned
> > from the INSERT in order to refresh my object.
>
> > Also, any idea if future releases of AR will support this
> > functionality?
>
> > Quote:
>
> > The “trigger-identity” is a NHibernate specific feature where the POID
> > is generated by the RDBMS at the INSERT query trough a BEFORE INSERT
> > trigger. In this case you can use any supported type, including custom
> > type, with the limitation of “single-column” (so far).
>
> > The query in ORACLE is:
>
> > INSERT INTO my_entity (Name) VALUES (:p0) returning Id
> > into :nhIdOutParam
>
> > Thanks.
> > martin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to