[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: the never ending flow of optimistic locking questions

fernando_jmt do-not-reply at jboss.com
Tue Jun 19 16:55:30 EDT 2007


I dealt with this time ago.

Here you can find a topic related (whether it's of your interest):
http://forum.hibernate.org/viewtopic.php?t=969898

After several tries I figured out that the only way (at least for me) to have this working is to have a POJO action and a SFSB DAO. 
POJO action and SFSB DAO are conversational, but the things that makes the difference are:
* Action must not have the SMPC.
* The SMPC must be in the SFSB and your update method must be marked (as you did) with TransactionAttributeType.REQUIRES_NEW. With this when the update fails you can read with the same EM (SFSB is requires).


This works for me, and I think it is a good approach.

Example of use:
I start a, at the same  conversation trying to edit a contact in its formtime (wherever located) other user opens to edit the same contact, user A saves fine its changes, but when user B tries to save, he is notified (in the same form) that someone else changes its data, and of course such data is displayed in the form.



HTH.


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

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



More information about the jboss-user mailing list