[jboss-user] [EJB 3.0] - How to get generated id after persiting an entity?

mike_ap do-not-reply at jboss.com
Wed Oct 22 18:33:30 EDT 2008


I have an entity with a sequence generator.

In my session bean I have a method with this code


  | em.persist(myEntity);
  | em.flush();
  | return myEntity;
  | 

after I get the object back. I try


  | myobj.getId()
  | 

but I always get 0 even though the record is inserted in the database and has an Id assigned.



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

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



More information about the jboss-user mailing list