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
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to