2 Replies Latest reply on May 21, 2003 4:10 AM by benholland

    ejb ql No such local object

    benholland

      Hello,

      Am using EJB QL to traverse a relationship. The
      QL is:


      <query-method>
      <method-name>findCustomerByAccountActivity</method-name>
      <method-params>
      <method-param>boolean</method-param>
      </method-params>
      </query-method>

      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(c) From CustomerBean C, IN (C.Accounts) AS A where A.IsActive= ?1]]>
      </ejb-ql>


      customer account is a one to many.
      an account can be active or inactive.

      When I get a collection of inactive accounts the first in the collection throws the following error while JBoss
      is trying to load the collection.

      13:01:59,483 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedB
      y:
      javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=2
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
      rceptor.java:158)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
      torCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
      04)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
      java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
      ryFinderInterceptor.java:122)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483

      If there is only one bean in the find then it loads fine.

      Am I doing anything wrong?
      thanks

      ben.

        • 1. Re: ejb ql No such local object
          benholland

          Have attached the mysql log. You can see where jboss rolls back the transaction. However the select does work returning two rows from the customer table.


          4 Query SET autocommit=1
          4 Query SHOW VARIABLES LIKE 'tx_isolation'
          4 Query SET autocommit=0
          4 Query SELECT DISTINCT t0_c.customer_id FROM mvdc_customer t0_c, mvdc_customer_account t1_d WHERE (t1_d.is_active = 0) AND (t0_c.customer_id=t1_d.fk_customer_id)
          4 Query SELECT customer_id,name, pword FROM mvdc_customer WHERE (customer_id=2) OR (customer_id=6263)
          4 Query rollback

          It seems that JBoss is checking the cache for the two primary keys and then throwing an exception when they are not there?
          Would appreciate if someone can cast a wise eye over this and give me a pointer.

          • 2. Re: ejb ql No such local object
            benholland

            problem was down to shabby coding in the primary key class.