4 Replies Latest reply on Apr 17, 2004 4:33 PM by jannik1024

    ejb finder

    osoe

      I have a Enity bean called CategoryBean which is mapped to sf_category table.

      My XDOCLET tag for the ejb.finder is

      * @ejb.finder
       * query = "SELECT OBJECT(g) FROM sf_category WHERE g.name = ?1"
       * signature = "java.util.Collection findName(String name)"


      ejb-jar.xml snippet is
      <query>
       <query-method>
       <method-name>findName</method-name>
       <method-params>
       <method-param>String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT OBJECT(g) FROM sf_category WHERE g.name = ?1]]></ejb-ql>
       </query>


      But When I deploy this bean I get the following error mesage on Jboss Console
      10:27:02,656 WARN [verifier] EJB spec violation:
      Bean : Category
      Method : public abstract Collection findName(String) throws FinderException
      Section: 10.5.6
      Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.


      Thanks for your help

        • 1. Re: ejb finder
          stscit04

          You have to specify the FULL qualified Name of the
          Classes. use java.lang.String instead of String.

          Regards

          Stefan

          • 2. Re: ejb finder
            osoe

            Thanks for your reply. I made the change and tried deploying again. No I get the following error. But the query looks right to me

            org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(a) FROM sf_category a where a.name = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "sf_category" at line 1, column 23.
            Was expecting one of:
             "IN" ...
             <ABSTRACT_SCHEMA> ...
             )
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:50)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:59)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:212)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:490)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)
             at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
            


            Thanks for the help

            • 3. Re: ejb finder
              sesques

              Your EJB-QL query must refers to your bean, not the table. So the query must be:

              SELECT OBJECT(g) FROM CategoryBean WHERE g.name = ?1

              Regards

              • 4. Re: ejb finder
                jannik1024

                 

                Your EJB-QL query must refers to your bean, not the table. So the query must be:

                SELECT OBJECT(g) FROM CategoryBean WHERE g.name = ?1

                Regards


                Solved my night, thx ;)