2 Replies Latest reply on Mar 8, 2002 1:31 PM by Geri House

    Problem with finder emthod in EJB20

    Geri House Newbie

      I have the following fider definition in the ejb-jar.xml File:


      <ejb-name>EtmnUserRoleTab</ejb-name>
      <local-home>etmn.db.EtmnUserRoleTabLocalHome</local-home>
      etmn.db.EtmnUserRoleTabLocal
      etmn.db.EtmnUserRoleTabHome
      etmn.db.EtmnUserRoleTab
      <ejb-class>etmn.db.EtmnUserRoleTabBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <abstract-schema-name>EtmnUserRoleTab</abstract-schema-name>
      <cmp-version>2.x</cmp-version>
      <cmp-field>
      <field-name>userId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>roleName</field-name>
      </cmp-field>
      <resource-ref>
      <res-ref-name>OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      <query-method>
      <method-name>findAllRolesForUser</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>select object(p) from EtmnUserRoleTab p where p.userId = ?1</ejb-ql>



      During deploying I get the following error from jboss 3.0 alpha:

      [13:47:58,837,ContainerFactory] Could not deploy file:/D:/Programme/jboss-3.0.0a
      lpha/deploy/Default/etmn.ear/
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.loadSelectors(
      JDBCEntityBridge.java:213)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEnt
      ityBridge.java:90)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.init(JDBCStoreManager
      .java:117)
      at org.jboss.ejb.plugins.CMPPersistenceManager.init(CMPPersistenceManage
      r.java:141)
      at org.jboss.ejb.EntityContainer.init(EntityContainer.java:313)
      at org.jboss.ejb.Application.start(Application.java:201)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:382)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:308)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:467)

      at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:
      444)
      at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:215)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:654)
      at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:327)

      I hope someone can help me please.

      Regards,
      Geri

        • 1. Re: Problem with finder emthod in EJB20
          Armin Newbie

          You are missing the <primkey-field> tag which goes after the last <cmp-field> tag.

          • 2. Re: Problem with finder emthod in EJB20
            Geri House Newbie

            I have made a mistake in the ejb-jar.xml, because the prim-key-class is a class. here teh right code snipped.
            But deployment does not work!


            <ejb-name>EtmnUserRoleTab</ejb-name>
            <local-home>etmn.db.EtmnUserRoleTabLocalHome</local-home>
            etmn.db.EtmnUserRoleTabLocal
            etmn.db.EtmnUserRoleTabHome
            etmn.db.EtmnUserRoleTab
            <ejb-class>etmn.db.EtmnUserRoleTabBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>etmn.db.EtmnUserRoleTabPK</prim-key-class>
            False
            <abstract-schema-name>EtmnUserRoleTab</abstract-schema-name>
            <cmp-version>2.x</cmp-version>
            <cmp-field>
            <field-name>userId</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>roleName</field-name>
            </cmp-field>
            <resource-ref>
            <res-ref-name>OracleDS</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>


            <query-method>
            <method-name>findAllRolesForUser</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql>select object(p) from EtmnUserRoleTab p where p.userId = ?1</ejb-ql>



            Regards.
            Geri