0 Replies Latest reply on Jun 9, 2005 4:18 AM by Matthew Todd

    ApplicationDeadlockException and read-only methods

    Matthew Todd Newbie

      I am currently getting ApplicationDeadlockExceptions being thrown. I am familiar with the reasons why deadlock can occur, however I am a little confused as to when entity beans are being locked.
      The stack trace for the exception shows that it originates from a method getY on my entity bean X called from a session bean method. I have marked all get* methods as being read-only. Y however is a CMR field, and the only method called before X.getY in my session beans method is a finder that returns the X entity bean. Does this mean the finder method is locking and also the getY method on the X entity bean is locking?

      sample code

      public void MySessionMethod( String pk )
       XLocal x = getXLocalHome().findByPrimaryKey(pk);
       YLocal y = x.getY();

      it is the x.getY() that is causing the ApplicationDeadlockException

      Thanks in advance