This content has been marked as final.
Show 2 replies
-
1. Re: EJB3 Entity Primary Key Retrieval
marcioendo Mar 28, 2006 8:57 AM (in response to wargun02)I had the same question before.
Supposing the method entityObj.getId() returns the value or field annotated as @Id, what you can do is the following:MyEntity entityObj = new MyEntity(...); em.persist(entityObj); long assignedPrimaryKey = entityObj.getId();
Regards.
Marcio Endo -
2. Re: EJB3 Entity Primary Key Retrieval
wargun02 Mar 28, 2006 10:42 PM (in response to wargun02)Thanks Marcio,
This is a cool solution, it worked! Tested and verified. Thanks again.
Regards,
Max Lam