3 Replies Latest reply on Oct 3, 2002 12:07 PM by Schneider

    Finder method problems in the Deploy stage.

    Jay McGaffigan Newbie

      Hello,

      I am trying to learn EJB CMP 2.0 and Jboss at the same time. I've been doing a lot of reading and I am now at a point where I need to ask for some help. I have a Results table in a database. I am trying to create a CMP Bean to access this table. When I get to the deploy stage I get the following Exception:


      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.UnknownPathException: Unknown terminal field: at line 1, column 58. Encountered: "tastingid" after: "s.")
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:44)


      Here is an excerpt from my ejb.java file:

      /**
      * This is the EJB definition for the Tasting Results Bean. Each bean is associated with a
      * wine a tasting and a score.
      *
      * @author jmcgaffigan
      *
      * ----- Below are the XDoclet tags used by Ant's EJB Doclet task to create
      * ----- the various components of an EJB for deployment.
      * @ejb:bean name="wine/ResultsEJB"
      * display-name="A collection of results"
      * type="CMP"
      * local-jndi-name="ejb/wine/ResultsEJB"
      * reentrant="false"
      * cmp-version="2.x"
      * view-type="local"
      * schema="ResultsSchema"
      *
      * @ejb:env-entry name="SequenceName"
      * value="ResultsEJB"
      *
      * @ejb:ejb-ref ejb-name="wine/SequenceGenerator"
      *
      * @ejb:transaction type="Required"
      *
      * @ejb:finder signature="java.util.Collection findAll()"
      * @ejb:finder signature="java.util.Collection findByScorer(java.lang.String scorer)"
      * query="SELECT OBJECT(s) FROM ResultsSchema AS s WHERE s.comment=?1"
      * @ejb:finder signature="java.util.Collection findByTasting(long tasting)"
      * query="SELECT OBJECT(s) FROM ResultsSchema AS s WHERE s.tastingid = ?1"
      *
      * @jboss:table-name table-name="tastingresults"
      * @jboss:create-table create="true"
      * @jboss:remove-table remove="false"
      */


      If I remove the finder for FindByTasting things compile deploy and everything is happy. The tastingid finder I am trying to build is keyed off an Integer(I've also tried long and int) and not a String. It seems that I can make finders that search based on String types but nothing else. Am I doing something wrong? or is there something about ejbql and jboss that isn't complete yet? I've read teh quick start manual, bought the jboss 3.0 pdf, am reading a couple of EJB books. But I can't seem to find the magic words that will tell me what's wrong.

      Any advice I can get would be most excellent.

      Jay

        • 1. Re: Finder method problems in the Deploy stage.
          Alexey Loubyansky Master

          I guess, ejb-jar.xml misses <cmp-field> element for tastingid.

          • 2. Re: Finder method problems in the Deploy stage.
            Jay McGaffigan Newbie

            Here is the excerpt for this bean from teh EJB-jar.xml file. It does have the cmp-field tags with tastingid... (please note that I need to fix the descriptions :) ).


            <![CDATA[This is the EJB definition for the Tasting Results Bean.]]>
            <display-name>A collection of results</display-name>

            <ejb-name>wine/ResultsEJB</ejb-name>

            <local-home>wine.interfaces.ResultsEJBLocalHome</local-home>
            wine.interfaces.ResultsEJBLocal

            <ejb-class>wine.entity.ResultsEJBCMP</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>wine.interfaces.ResultsEJBPK</prim-key-class>
            false
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>ResultsSchema</abstract-schema-name>
            <cmp-field >
            <![CDATA[Accessor method for getting the ID]]>
            <field-name>resultsId</field-name>
            </cmp-field>
            <cmp-field >
            <![CDATA[Accessor method for getting the host]]>
            <field-name>wineId</field-name>
            </cmp-field>
            <cmp-field >
            <![CDATA[Accessor method for getting the title]]>
            <field-name>tastingId</field-name>
            </cmp-field>
            <cmp-field >
            <![CDATA[Accessor method for getting the ID]]>
            <field-name>scorer</field-name>
            </cmp-field>
            <cmp-field >
            <![CDATA[Accessor method for getting the ID]]>
            <field-name>score</field-name>
            </cmp-field>
            <cmp-field >
            <![CDATA[Accessor method for getting the ID]]>
            <field-name>comment</field-name>
            </cmp-field>

            <env-entry>
            <env-entry-name>SequenceName</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>ResultsEJB</env-entry-value>
            </env-entry>

            <ejb-ref >
            <ejb-ref-name>ejb/wine/SequenceGenerator</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            wine.interfaces.SequenceGeneratorHome
            wine.interfaces.SequenceGenerator
            <ejb-link>wine/SequenceGenerator</ejb-link>
            </ejb-ref>


            <query-method>
            <method-name>findByScorer</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[SELECT OBJECT(s) FROM ResultsSchema AS s WHERE s.comment=?1]]></ejb-ql>


            <query-method>
            <method-name>findByTasting</method-name>
            <method-params>
            <method-param>long</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[SELECT OBJECT(s) FROM ResultsSchema AS s WHERE s.tastingid = ?1]]></ejb-ql>



            • 3. Re: Finder method problems in the Deploy stage.
              Schneider Newbie

              try s.tastingId instead of s.tastingid
              everything is casesensitive

              rudi