Assuming the auto-id is your primary key, what would
you use as the entity bean's primary key?
Frank T. Villarreal, Jr. Email [EMAIL PROTECTED]
Hi all,
while we all in this list have debated about the
best way to have an Autoincrement-like feature in our EJB (using AutoNumber
bean, using a singleton session bean to retrieve the newly created id in the
db, etc.), i've just came through a text at jGuru - in FAQ section about EJB -
about a fairly simple way to handle auto-incr with CMP. I'd just like want to
know if anyone has tested the suggested method, and if it works correctly with
jBoss ....
Any comment would be higly
appreciated.
--hermann
From jGuru :
Question |
How does Container
Managed Persistence work with automatically generated database ID
fields? Should I map the ID field explicitly or leave it unspecified?
|
Answer In the Deployment Descriptor,
map the normal fields appropriately, but don't specify the auto-id field as
one of the container managed fields.
|