1 Reply Latest reply on Jan 9, 2004 10:51 AM by Darran Lofthouse

    EJB EntityBeam CMP - How To

    videschi Newbie

      Please,

      Any body can help me use mey EntityBeam CMP.
      I implement the Remote, Home interfaces and may EntityBean class to use a CMP, but when i execute mey method findAll() my result is a collection empty.
      I have 3 files .xml in my META-INF:

      * ejb-jar.xml
      * jboss.xml
      * jbosscmp-jdbc.xml


      my ejb-jar:


      <ejb-jar>
      <display-name>KeysEJB</display-name>
      <enterprise-beans>

      Chaves e Valores
      <ejb-name>Account2</ejb-name>
      com.ejb.entity.AccountHome2
      com.ejb.entity.Account2
      <ejb-class>com.ejb.entity.AccountBean2</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <resource-ref>
      <res-ref-name>jdbc/dssystem</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Account2</abstract-schema-name>
      <cmp-field><field-name>chave</field-name></cmp-field>
      <cmp-field><field-name>valor</field-name></cmp-field>
      <primkey-field>chave</primkey-field>

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




      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>


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

      <trans-attribute>Required</trans-attribute>

      </container-transaction>

      </assembly-descriptor>
      </ejb-jar>


      my jboss.xml:


      <enterprise-beans>

      <ejb-name>Account2</ejb-name>
      <jndi-name>ejb/AccountHome2</jndi-name>


      </enterprise-beans>

      <resource-managers>
      <resource-manager>
      <res-name>jdbc/dssystem</res-name>
      <res-jndi-name>java:/DSSystem</res-jndi-name>
      </resource-manager>
      </resource-managers>



      my jbosscmp-jdbc.xml:

      <jbosscmp-jdbc>


      java:/DSSystem
      <type-mapping>oracle8</type-mapping>
      true
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <time-out>0</time-out>
      <select-for-update>false</select-for-update>
      <pk-constraint>true</pk-constraint>
      <relation-mapping-style>foreign-key</relation-mapping-style>
      <read-ahead>
      on-load
      <page-size>500</page-size>
      <eager-load-group>group name</eager-load-group>
      </read-ahead>


      <enterprise-beans>

      <ejb-name>Account2</ejb-name>
      <table-name>ACCOUNT_T2</table-name>
      <cmp-field>
      <field-name>chave</field-name>
      <column-name>CHAVE</column-name>
      </cmp-field>

      <cmp-field>
      <field-name>valor</field-name>
      <column-name>VALOR</column-name>
      </cmp-field>


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