[jboss-user] [JBoss Seam] - how can I do optimistic locking with crud framework?

cja987 do-not-reply at jboss.com
Thu Oct 19 15:39:50 EDT 2006


Newbie question alert... I'm working with the contactlist sample app (works fine now that I'm back to using myfaces) and I want to prevent lost updates.  I added a version field to Contact, gave it a @Version annotation, and a getter/setter pair, and it seems to get updated by Hibernate as expected.  But when I try overlapping edits, I just can't seem to get it to throw an OptimisticLockException, the last commit still wins every time.

Am I naively assuming that just adding a @Version field turns optimistic lock enforcement on automatically?  Is there something else I need to do to make optimistic locking work?

I'm not quite sure, when and if I do get it working, what the practice for handling such an exception is either.  I suppose I can hack in some kind of redirect.


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

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



More information about the jboss-user mailing list