0 Replies Latest reply on Apr 12, 2004 2:51 PM by jchang

    Threads contention

    jchang

      Hello everybody,

      I have two threads executing a findby.... method (from an entity bean) almost at the same time in a STATELESS session bean but one of them is deleting a record in the database. Thus, the other one complains with the following error:

      javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=11e1813-fbd1ae2521-b88d8e8d57a53bc420279153d2e46f6f
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      ...

      I have declared all my finder methods from the entity bean and the method that calls these finders in the STATELESS session bean to be transaction type "Required" and NOT read only.

      I thought that if a method is not read-only then only one thread can execute at one time (Transaction locking).

      How can I accomplish that?

      Thanks in advance,

      jchang
      By the way, I am using JBoss 3.2.1 and EJB 2.0