3 Replies Latest reply on Dec 18, 2005 6:40 PM by swing

    EJB 2.0 finders with xdoclet in JBoss 4.0.2

    Roberto Fasciolo Newbie

      I'm trying to develop some entity beans for running with jboss using xdoclet.

      When I try to deploy them in jboss I get this error:

      2005-09-10 12:37:36,859 WARN [org.jboss.ejb.EJBDeployer.verifier] EJB spec violation:
      Bean : Subsites
      Method : public abstract Collection findBySite(Long) throws FinderException, RemoteException
      Section: 10.5.6
      Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.

      This is the xdoclet definition of that ejb:
      /**
      * @ejb.bean name="Subsites"
      * display-name="Name for Subsites"
      * description="Description for Subsites"
      * jndi-name="ejb/katti/sites/Subsites"
      * type="CMP"
      * cmp-version="2.x"
      * view-type="remote"
      *
      * @ejb.finder signature="java.util.Collection findBySite(Long id_site)"
      * query="select object(o) from Subsites o where o.id_site=?1"
      *
      * @ejb.transaction
      * type="Required"
      */

      This is the related part of the ejb-jar.xml:

      <![CDATA[Description for Subsites]]>
      <display-name>Name for Subsites</display-name>

      <ejb-name>Subsites</ejb-name>

      com.rf.katti.ejb.sites.SubsitesHome
      com.rf.katti.ejb.sites.Subsites

      <ejb-class>com.rf.katti.ejb.sites.SubsitesBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.rf.katti.ejb.sites.SubsitesPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Subsites</abstract-schema-name>
      <cmp-field >
      <![CDATA[Getter for CMP Field id]]>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field id_site]]>
      <field-name>id_site</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field name]]>
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field defaultLanguage]]>
      <field-name>defaultLanguage</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field createstmp]]>
      <field-name>createstmp</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field updatestmp]]>
      <field-name>updatestmp</field-name>
      </cmp-field>


      <query-method>
      <method-name>findBySite</method-name>
      <method-params>
      <method-param>Long</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[select object(o) from Subsites o where o.id_site=?1]]></ejb-ql>

      <!-- Write a file named ejb-finders-SubsitesBean.xml if you want to define extra finders. -->


      <![CDATA[Description for Subsites]]>
      <display-name>Name for Subsites</display-name>

      <ejb-name>Subsites</ejb-name>

      com.rf.katti.ejb.sites.SubsitesHome
      com.rf.katti.ejb.sites.Subsites

      <ejb-class>com.rf.katti.ejb.sites.SubsitesBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.rf.katti.ejb.sites.SubsitesPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Subsites</abstract-schema-name>
      <cmp-field >
      <![CDATA[Getter for CMP Field id]]>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field id_site]]>
      <field-name>id_site</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field name]]>
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field defaultLanguage]]>
      <field-name>defaultLanguage</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field createstmp]]>
      <field-name>createstmp</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Getter for CMP Field updatestmp]]>
      <field-name>updatestmp</field-name>
      </cmp-field>


      <query-method>
      <method-name>findBySite</method-name>
      <method-params>
      <method-param>Long</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[select object(o) from Subsites o where o.id_site=?1]]></ejb-ql>

      <!-- Write a file named ejb-finders-SubsitesBean.xml if you want to define extra finders. -->


      jbosscmp-jdbc.xml:

      <ejb-name>Subsites</ejb-name>

      <cmp-field>
      <field-name>id</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>id_site</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>defaultLanguage</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>createstmp</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>updatestmp</field-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->



      <ejb-name>Subsitelanguages</ejb-name>

      <cmp-field>
      <field-name>id_subsite</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>id_language</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>createstmp</field-name>

      </cmp-field>

      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->


      jboss.xml:

      <ejb-name>Subsites</ejb-name>
      <jndi-name>ejb/katti/sites/Subsites</jndi-name>

      <method-attributes>
      </method-attributes>




      I've written also other finders, but they works only if the finder method takes no parameters (for example "java.util.Collection findAll()"), otherwise I get that error. Can you help me?