Re: Primary keys for entity beans with Bean Managed Persistence
Thursday, March 4, 2004 07:51 AM
Typically I would use a sequence such as oracle sequence to generated unique Primary keys during database insert time. So mmultiple inserts do not create duplicates at runtime and the BMP need not set the PK since the database sequence takes care of setting the value.
Also its a good idea to set database level constraints to take care of concurrency to be on the safter side.
You could also try to use BMP with CMT (container managed transactions) with exclusive or pessimistic locking if your data integrity is such a constraint.