0 Replies Latest reply on Jul 11, 2005 5:31 AM by Michael Jürgens

    Avoiding Application Deadlock

    Michael Jürgens Newbie


      I´ve a question about how to avoid a application deadlock in the following situation:

      Having two applications (x and y) using two entities (a and b) in many-to-many relation.

      x accesses a by primary key and then b from a.
      y accesses b by primary key and then a from b.

      If x and y access the same entities at the same time we have a deadlock.

      Since both applications are jms driven it is not a very big problem because we get a rollback an a try again. But we get a lot of error messages ...

      I´m looking for a smarter solution. It would be very easy if it will be prossible to lock the entity a and its dependent b entities in an atomic operation.
      Y will then wait until x finished its transaction.

      But how can I write such a finder method?
      EJBQL does not help?