Error in ejb-jar.xml for Entity Bean CMPHome: expected only one prim-key-class 
tag 

Hi, 

There is an error during deployment as the error says "expected only one 
prim-key-class tag" in the ejb-jar.xml. Below is the ejb-jar.xml code. 


  | 
  | <?xml version="1.0" ?> 
  |   <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise 
JavaBeans 2.0//EN" "http://www.jboss.org/j2ee/dtd/ejb-jar_2_0.dtd";> 
  | <ejb-jar>
  |    <enterprise-beans>
  |       <session>
  |             <ejb-name>Employee Session</ejb-name>
  |             <home>com.test.EmpHome</home>
  |             <remote>com.test.EmpRemote</remote>
  |             <ejb-class>com.test.EmpBean</ejb-class>
  |             <session-type>Stateful</session-type>
  |             <transaction-type>Bean</transaction-type>
  |             <ejb-local-ref>
  |                 <description>This is the reference to the CMP 
bean</description>
  |                 <ejb-ref-name>ejb/local/CMPHome</ejb-ref-name>
  |                 <ejb-ref-type>Entity</ejb-ref-type>
  |                 <local-home>com.test.CMPHome</local-home>
  |                     <local>com.test.CMPRemote</local>
  |                 <ejb-link>CMPHome</ejb-link>
  |        </ejb-local-ref>
  |       </session>
  |    
  |       <entity>
  |          <ejb-name>CMPHome</ejb-name>
  |          <local-home>com.test.CMPHome</local-home>
  |          <local>com.test.CMPRemote</local>
  |          <ejb-class>com.test.CMPBean</ejb-class>
  |          <persistence-type>Container</persistence-type>
  |      <cmp-version>2.x</cmp-version>
  |      <abstract-schema-name>Employee</abstract-schema-name>
  |          <prim-key-class>java.lang.String</prim-key-class>
  |          <reentrant>False</reentrant>
  |          <cmp-field>
  |             <field-name>id</field-name>
  |          </cmp-field>
  |          <cmp-field>
  |             <field-name>empId</field-name>
  |          </cmp-field>
  |          <cmp-field>
  |             <field-name>empName</field-name>
  |          </cmp-field>
  |      <primkey-field>id</primkey-field>
  |      <query>
  |         <description>Gets whole collection of Employees</description>
  |         <query-method>
  |           <method-name>findEmployee()</method-name>
  |           <method-params/>
  |         </query-method>
  |         <ejb-ql>Select OBJECT(r) From Employee r</ejb-ql>
  |       </query>
  |       
  |       <abstract-schema-name>Customer</abstract-schema-name>
  |       <prim-key-class>java.lang.Integer</prim-key-class>
  |       <reentrant>False</reentrant>
  |          <cmp-field>
  |             <field-name>cid</field-name>
  |          </cmp-field>
  |          <cmp-field>
  |             <field-name>custId</field-name>
  |          </cmp-field>
  |          <cmp-field>
  |             <field-name>custName</field-name>
  |          </cmp-field>
  |      <primkey-field>cid</primkey-field>
  |      <query>
  |         <description>Gets whole collection of Customer</description>
  |         <query-method>
  |           <method-name>findCustomer()</method-name>
  |           <method-params/>
  |         </query-method>
  |         <ejb-ql>Select OBJECT(a) From Customer a</ejb-ql>
  |       </query>
  |      
  |      </entity>
  |      </enterprise-beans>
  |      
  |    <assembly-descriptor>
  |       <container-transaction>
  |          <method>
  |             <ejb-name>CMPHome</ejb-name>
  |             <method-name>*</method-name>
  |          </method>
  |          <trans-attribute>Required</trans-attribute>
  |       </container-transaction>
  |    </assembly-descriptor>
  |  
  | </ejb-jar>
  | 
  | 


Here I am trying to do multiple table transactions in one CMP bean...that why 
there are two prim key class tags in the ejb-jar.xml.  Is this multiple table 
transactions possible in one CMP bean? If so what is the best way to overcome 
this problem. If not any suggestion to code multiple table transactions. Please 
suggest the same.

Thank you,
Mallikarjun.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151272#4151272

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151272
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to