[jboss-user] [JBoss Seam] - Re: Getting Id of Presisted object.

christian.bauer@jboss.com do-not-reply at jboss.com
Fri May 11 08:10:11 EDT 2007


You can call em.flush() whenever you want, nobody can prevent that. However, if "whenever" is a good time to synchronize in-memory persistence context state with the database is another question. An exception would probably indicate that this is not a good time. 

So no, you don't have any way or guarantee to get an identifier from an entity until it is finally persisted during flushing.

One other hand, if you use a sequence generator, Hibernate will assign an identifier to the instance at the time you call persist(o). But this is an implementation detail and not standardized anywhere.

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

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



More information about the jboss-user mailing list