[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Value of identity column with JBoss 4.0.5 JPA entity manager

earniedyke do-not-reply at jboss.com
Thu Sep 6 11:32:38 EDT 2007


Greetings all,

I have an EJB3 stateless bean that defines the following entity manager:

@PersistenceContext
  | @PersistenceUnit(unitName = "SimPersistence")
  | EntityManager em;

When I persist a new object via em.persist(o) I need to get the value of the identity column back. How can I do that? o.getId() returns 0. I have tried em.flush() followed by em.refresh(o) which did not work either.

Any and all help is appreciated.

Earnie!

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

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



More information about the jboss-user mailing list