[jboss-user] [EJB 3.0] - Correct recovery with optlock and extended PC

gena777 do-not-reply at jboss.com
Sat Jul 7 10:23:55 EDT 2007

Hello all,

some entity was changed otherwise during it was editing in web. This entity is associated with an extended persistent context. After trying to persist the changes, it naturally (as expected) throws an exception. My idea is

  | Entity merged = em.merge(dirtyEntity) ;
  | if(merged.isModifiable())
  |   em.persist(merged);

quite simple, but the merge returns an entity with old version number (doesn't hit the DB). So this simple case doesn't work.

What is the best way to recover from the optimistic lock exception/issue?

Thank you for advise, Gena

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

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

More information about the jboss-user mailing list