1 Reply Latest reply on Apr 15, 2004 9:59 AM by Sascha Kulawk

    How to disable transaction locking for readonly methods?

    Sascha Kulawk Newbie

      Hello,

      I have a big problem with my application.
      I have a transaction witch will take some time to complete - about 10 minutes in general. Here the transaction context is Required. Inside the trancation many entity beans are accessed, removed and created.
      During this transaction someone could walk on the website - the website also needs read-access to the same beans.
      To avoid deadlocks I'm using "Instance Per Transaction CMP 2.x EntityBean" as container-configuration.
      The problem occures, that the calls to the website even are going though a transaction-type "Never" SessionBean call and are blocked - so I will get the following error:

      Caused by: javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0id=136026
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(Lorg.jboss.ejb.EntityEnterpriseContext;)V(Optimized Method)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(Lorg.jboss.ejb.EntityEnterpriseContext;)V(Optimized Method)
      at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(Lorg.jboss.ejb.EntityEnterpriseContext;)V(Optimized Method)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(Lorg.jboss.ejb.EntityEnterpriseContext;)V(Optimized Method)
      at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(Ljavax.transaction.Transaction;)V(Optimized Method)
      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapSynchronize.beforeCompletion()V(Optimized Method)
      at org.jboss.tm.TransactionImpl.doBeforeCompletion()V(Optimized Method)
      at org.jboss.tm.TransactionImpl.commit()V(Optimized Method)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(Lorg.jboss.invocation.Invocation;Ljavax.transaction.Transaction;Ljavax.transaction.Transaction;)V(Optimize
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.EntityContainer.internalInvoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.Container.invoke(Lorg.jboss.invocation.Invocation;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(Ljava.lang.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object;)Ljava.lang.Object;(Optimized Method)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(Ljava.lang.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object;)Ljava.lang.Object;(Optimized Method)
      at $Proxy102.getModifiedDate()Ljava.util.Date;(Unknown Source)

      May this be a result of a container managed relationship?
      All getter of this entity beans are marked as "supported" transaction.
      The last possibility would be to create special read-only entity beans for calling them for website displaying - but this will result in a lot of work. is there maybe another solution what I've not found?

      Thank you very much,

      Sascha Kulawik

        • 1. Problem occures because of CMP field access to a (through an
          Sascha Kulawk Newbie

          I've seen, the problem occures if the longterm transaction deletes a bean which will be later accessed through a second transaction (different client) while the first transaction is not completed.
          Surprising was, that the CMR was not the fault - i've checked the method the second transaction called and added some additional lines.
          Only if I want to return the Date cmr.getModifiedDate() the transaction hangs.

          Does anybody has a solution?!?!