Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to refresh CMP Bean data?

843829Sep 10 2002 — edited Apr 11 2004
Hi,

I'm trying to develop a CMP bean on a DB table that has a column defined as "auto increment", i.e. I don't set any value for this attribute in ejbCreate() and the DB manager sets it when the row is inserted.

In order to get the value assigned to the column in the same client method that created it, I invoke a finder that retrieves the just created Bean by looking for another column value.

To my dismay, the contents of the "auto increment" attribute is still null, which suggests that either the container has not yet performed the insert in the DB, or it performs a first search in its storage instead of accessing the persistent media.

How can I force the container to immediately store the bean in the DB and refresh its data to get the automatically generated value? I suppose I could do it with a BMP (right?), but I'd rather use a CMP if possible.

Thanks for any suggestion that can help,

Pere Torrodellas
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2004
Added on Sep 10 2002
18 comments
377 views