0 Replies Latest reply on Jan 31, 2007 7:48 AM by jameswoodward

    Example of Database Locking

    jameswoodward Newbie


      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,