3 Replies Latest reply on Jul 1, 2002 4:52 AM by Sylvain Munaut

    Problems with ejb-ql

    Sylvain Munaut Newbie

      Hi,

      I'm having troubles while getting ejb-ql to work.

      I try to implement a query and I can't get any results.
      The query is "findDesc(String description)" (defined in the Home interface and ejb-jar.xml).
      I know I can use the findByXX but it is just a test to see if it works....
      There are no exceptions, just any empty resul set.
      The findAll() method is working, and the DB s working fine as well...
      I tried to implement the method with and without params...

      Tried some other thing but I out of imagination ....

      So may be I am missing some points....


      If anyone has any idea, it would be very help full


      In ejb-jar.xml:

      ....
      <enterprise-beans>

      Models a Stock IN or OUT operation
      <ejb-name>StockOp</ejb-name>
      test1.interfaces.StockOpHome
      test1.interfaces.StockOp
      <ejb-class>test1.bean.StockOpBean</ejb-class>
      <persistence-type>Container</persistence-type>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>StockOp</abstract-schema-name>
      <cmp-field><field-name>ref</field-name></cmp-field>
      <cmp-field><field-name>description</field-name></cmp-field>
      <prim-key-class>java.lang.Integer</prim-key-class>
      <primkey-field>ref</primkey-field>



      <query-method>
      <method-name>findDesc</method-name>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM StockOp AS a WHERE a.description = ?1]]>
      </ejb-ql>

      </enterprise-beans>
      ....


        • 1. Re: Problems with ejb-ql
          Sylvain Munaut Newbie

          Ok I've found one of the problems, it was in the DOCTYPE definition in ejb-jar.xml, I left an EJB 1.1 definition instead of 2.0.


          But for now I'm running into a new problem .... :

          [java] javax.ejb.FinderException: Unknown query: public abstract java.util.Collection test1.interfaces.StockOpHome.findTest() throws javax.ejb.FinderException,java.rmi.RemoteException

          The StockOpHome.java has:

          public Collection findTest() throws FinderException, RemoteException;

          The ejb-jar.xml has:


          <query-method>
          <method-name>findTest</method-name>
          <method-params>
          </method-params>
          </query-method>
          <ejb-ql>
          <![CDATA[SELECT OBJECT(a) FROM StockOp AS a WHERE a.ref IS NOT NULL]]>
          </ejb-ql>



          • 2. Re: Problems with ejb-ql
            Dain Sundstrom Master

            That is weird. You are calling a finder and the persistence manager can not find the query specification. Try a clean build of your application.

            If that doesn't work, increase the log level of the org.jboss.ejb.plugins.cmp to DEBUG in the log4j.xml file. Then run your application and search the server log for anything related to findTest.

            • 3. Re: Problems with ejb-ql
              Sylvain Munaut Newbie

              It's ok it works !

              In the xml file ejb-jar, I misplaced an tag and the query were out the entity ...