This is a follow up to a discussion about a month ago about using
sequences with container managed persistence. The solution presented
seemed to be that you should just make the id field a normal field and
do the sequence stuff manually during ejbCreate. However, I thought that
beans using container managed persistence weren't supposed to open
database connections and that it all had to be left to the container. Is
that right?

The next problem I've got is that I'm using MS SQL Server rather than
PostgreSQL, and I don't know how to use sequences manually. The
"identity" feature of SQL Server can only be triggered by an INSERT, as 
far as I can tell.

Does anyone have a neat way of generating a signed 32-bit integer that
is guaranteed not be in the table already? Any more general advice on
the best way to handle primary key fields?

Thanks for your time.

-- 
Lachlan O'Dea <mailto:[EMAIL PROTECTED]>   Computer Associates Pty Ltd
Webmaster                                   Vet - Anti-Virus Software
http://www.vet.com.au/

"What is wanted is not the will to believe, but the will
to find out, which is the exact opposite."
- Bertrand Russell

Reply via email to