Hello,
I'm looking for a way to generate primary keys for my container managed
entity beans.
For bean managed persistance you would simply use the functions that
your DBMS provides, like sequences or auto-increased columns. But how do
I do this with CMP beans? In books and example code everyone avoids the
subject entirely, with
create(int id)
as the creation method.
A solution I've seen suggested is to use a separate session bean to
generate unique integers, but they are generally a mess to implement and
use. So what I'm looking for is something better than that.
The J2EE servers based on object databases (GemStone/J at least) has an
id generator "for free". But it seems this shouldn't be impossible with
relational DBMSes. I would guess that it could be done by the CMP
container, possibly by using DBMS-dependent plugins for different id
generator implementations?
Anyway, if this isn't possible I'm looking for a good implementation of
a session bean based id generator...
/Anders
________________________________________________________________________
A n d e r s B e n g t s s o n [EMAIL PROTECTED]
http://www.natakademin.se/