1 Reply Latest reply on Sep 2, 2004 3:07 AM by Alexey Loubyansky

    problem with findAll inside a Stateless

    alessandro zambonelli Newbie

      Hi,

      i've a simple EJB without local interfaces.
      The method findByPrimaryKey works fine
      But the findAll method (or another method that return a collection) works ONLY inside a servlet, not inside a Stateless Session Bean.

      This is JBoss Log:

      ---> findAll in a servlet (it works):

      10:47:29,366 DEBUG [Gruppi#findAll] Executing SQL: SELECT t0_o.PK_ID, t0_o.NOME FROM GRUPPI t0_o
      10:47:29,371 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,375 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,378 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,382 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,386 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,390 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,394 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)
      10:47:29,404 DEBUG [Gruppi] Executing SQL: SELECT NOME FROM GRUPPI WHERE (PK_ID=?)


      --> findAll in a Stateless:
      10:47:29,366 DEBUG [Gruppi#findAll] Executing SQL: SELECT t0_o.PK_ID, t0_o.NOME FROM GRUPPI t0_o
      10:49:41,992 DEBUG [Gruppi#findAll] Executing SQL: SELECT t0_o.PK_ID FROM GRUPPI t0_o
      10:49:41,998 DEBUG [Gruppi] Executing SQL: SELECT PK_ID, NOME FROM GRUPPI WHERE (PK_ID=?) OR (PK_ID=?) OR (PK_ID=?) OR (PK_ID=?)
      10:49:42,007 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract long com.kirio.OrderEntry.Gruppi.getPk_id() throws java.rmi.RemoteException, causedBy:
      java.rmi.NoSuchObjectException: Entity not found: primaryKey=com.kirio.OrderEntry.GruppiPK@1687dcd


      I can resolve this in two ways:

      1) by adding the local interface
      2) by optimizing the findAll, moving the finders inside standardjbosscmp-jdbc.xml, with a load strategy:

      <query>
       <query-method>
       <method-name>findAll</method-name>
       <method-params/>
       </query-method>
       <jboss-ql><![CDATA[
       select object(o) from Gruppi o
       ]]></jboss-ql>
       <read-ahead>
       <strategy>on-find</strategy>
       </read-ahead>
       </query>

      Is this a JBoss bug or a mistake in some part of my application ?

      hi
      alessandro