> 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).
You will need to generate the keys. Using a table to manage them is the way
to go. For efficiency's sake, I use a stateless session to hand out keys, and
I can tell it I want "a dozen" keys and it reserves that "range". This prevents
any contention issues.
tim.
===========================================================================
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".