Nhibernate with oracle is the best way to augment primary key

I am using Nhibernate for oracle and I need to increment the primary key value for every insert. Which one is the best way and efficient way? Oracle sequence, Nhinerbate step or some other way?

+2


source to share


2 answers


With oracle, you can use seqhilo

which uses a database sequence instead of a separate table. You get the advantage of hilo (in-memory key generation, no need for db roundtrip) and consistency (no separate transaction) at the same time.



+2


source


You can use hilo in Nhibernate to generate your IDs (NHibernate is the preferred way to manage IDs right now).



+1


source







All Articles