Hi,

I have a problem with retrieving the primary key of an entity object after 
persisting. My case is:

:- I have an entity object which has the id as the primary key field of type 
long and the value is auto generated by the database (and with all necessary 
annotations assigned)
:- After I invoke the EntityManager "em" to persist my entity (e.g. 
em.persist(entityObj) ), I want to know what was the newly assigned primary key 
by the database.

So, is there any way to retrieve the newly assigned primary key of the entity, 
since the EntityManager.persist() method returns nothing (void)?

Any suggestion will be greatly appreciated. Thank you.


Max Lam

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3933024#3933024

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3933024


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to