Hello all!

I am looking for a good way to generate primary keys for my entities and I
was wondering if there is a "standard" way.

Each of my entities maps to an oracle table, and I would like each table to
have its own key sequence.

One way I can think of is to query oracle for the next key in the table's
sequence prior to .creating() my entity bean but that seems like a great
overhead given that I would need to go to the database twice for every
insert I do (one to get the key, and one to insert it).

Another way would be to ask oracle for a key as a starting point and then
increase it until I have done all my inserts (for a transaction?) and then
tell oracle the new value for the sequence. This may be more efficient but I
am not sure how safe it is given that while I am increasing my sequence some
other process may query oracle for the next key (in which case we would both
use the same).

All ideas are very welcome!

Michael

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to