0 Replies Latest reply on Dec 9, 2003 2:21 PM by afranken

    Help.  Find failed: javax.ejb.EJBException: Internal error s

    afranken Newbie

      I have an Entity EJB with a Custom PrimaryKey class which contains 3 primitives.
      These primitives are cmp fields. When I do a finder method, I get an error
      because it tries to populate the primitive field with a null value. How can I get around this.
      I am porting over an EJB project from weblogic to jboss so I know this worked on
      weblogic. HELP IS GREATLY APPRECIATED

      Error:
      javax.ejb.FinderException: Find failed: javax.ejb.EJBException: Internal error setting instance field subAcctNum; CausedByException is: null

      ejb-jar.xml

      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <enterprise-beans>


      <ejb-name>AcctAccessMatrix</ejb-name>
      com.acs.vsx.account.ejb.AcctAccessMatrixHome
      com.acs.vsx.account.ejb.AcctAccessMatrix
      <ejb-class>com.acs.vsx.account.ejb.AcctAccessMatrixEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.acs.vsx.account.ejb.AcctAccessMatrixPK</prim-key-class>
      False
      <abstract-schema-name>AcctAccessMatrix</abstract-schema-name>
      <cmp-version>1.x</cmp-version>
      <cmp-field>
      <field-name>accessLevel</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>subAcctNum</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>univAcctNum</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>iDNumber</field-name>
      </cmp-field>

      <!--This query is overridden in jbosscmp-jdbc.xml to include ORDER BY in EJBQL by element (jboss-ql)-->

      <query-method>
      <method-name>findByIdNum</method-name>
      <method-params>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM AcctAccessMatrix a WHERE (a.iDNumber = ?1)]]>
      </ejb-ql>


      <query-method>
      <method-name>findAll</method-name>
      <method-params/>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM AcctAccessMatrix a]]>
      </ejb-ql>


      <query-method>
      <method-name>findMySubAcctAccessLevel</method-name>
      <method-params>
      <method-param>int</method-param>
      <method-param>int</method-param>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM AcctAccessMatrix a WHERE (a.iDNumber = ?1 AND a.univAcctNum = ?2 AND a.subAcctNum = ?3)]]>
      </ejb-ql>


      <query-method>
      <method-name>findMyUnivAccessLevel</method-name>
      <method-params>
      <method-param>int</method-param>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[SELECT OBJECT(a) FROM AcctAccessMatrix a WHERE (a.iDNumber = ?1 AND a.univAcctNum = ?2)]]>
      </ejb-ql>

      <!--

      <query-method>
      <method-name>findAll</method-name>
      </query-method>

      -->

      <resource-ref>
      <res-ref-name>jdbc/msSQL7EJBPool</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>AcctAccessMatrix</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>NotSupported</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      jbosscmp-jdbc.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">


      <jbosscmp-jdbc>

      java:/msSQL7EJBPool
      <datasource-mapping>MS SQLSERVER</datasource-mapping>
      <!--<entity-command name="mssql-fetch-key"/> -->

      <enterprise-beans>

      <ejb-name>AcctAccessMatrix</ejb-name>
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <table-name>AcctAccessMatrix</table-name>

      <cmp-field>
      <field-name>iDNumber</field-name>
      <column-name>IDNUMBER</column-name>
      <not-null/>

      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>subAcctNum</field-name>
      <column-name>SUBACCTNUM</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>accessLevel</field-name>
      <column-name>ACCESSLEVEL</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>univAcctNum</field-name>
      <column-name>UNIVACCTNUM</column-name>
      <not-null/>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>
      <!-- overriding ejb-ql in ejb-jar.xml to include ORDER BY clause -->

      <query-method>
      <method-name>findByIdNum</method-name>
      <method-params>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <jboss-ql>
      <![CDATA[SELECT OBJECT(a) FROM AcctAccessMatrix a WHERE (a.iDNumber = ?1) ORDER BY a.iDNumber, a.univAcctNum, a.subAcctNum]]>
      </jboss-ql>



      </enterprise-beans>
      </jbosscmp-jdbc>