[jboss-user] [EJB 3.0] - Example of Database Locking

JamesWoodward do-not-reply at jboss.com
Wed Jan 31 07:48:38 EST 2007


Hi,

I've trawled through the forums and can't find a solution to what must be a common problem.

I have 2 clients that each access their own SFSBs. They pass a list of Order objects to the SFSB. For each order, the SFSB makes a call to another SFSB which allocates a transaction id, which it reads, increments and updates in a legacy database table.

I can't seem to find the correct approach.

If I don't have a @Version column, then the same transaction id is allocated more than once, which isn't acceptable.

If I do have a @Version column, then I get various exceptions thrown (OptimisticLockException, StaleObjectStateException, GenericJDBC Exception) none of which seem to allow recovery.

Basically, I want one process to wait for the other to complete. Which I would do outside EJB with a synchronized block, or with pessimistic locking.

Is there an example of how to do this?

Thanks In Advance,
James


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

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



More information about the jboss-user mailing list