NetSide
NetSide

Reputation: 3890

Nhibernate with oracle - best way for primary key increment

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

Upvotes: 2

Views: 2572

Answers (2)

Stefan Steinegger
Stefan Steinegger

Reputation: 64628

With oracle, you could use seqhilo, which uses a database sequence instead of a separate table. You get the advantage of hilo (key generation in memory, no db roundtrip needed) and sequences (no separate transaction needed) at the same time.

Upvotes: 2

Sly
Sly

Reputation: 15227

You can use hilo in Nhibernate for generating your Ids (for NHibernate it is most preferable way for managing Ids now).

Upvotes: 1

Related Questions