[jboss-user] [EJB/JBoss] - Error in ejb-jar.xml for Entity Bean CMPHome: expected only
mallikarjun_nbsg
do-not-reply at jboss.com
Fri May 16 02:59:51 EDT 2008
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>
|
|
I want to code a program such that...my CMP Bean (using only one bean) should do transactions on two or more tables. The transactions can be INSERT, SELECT....etc, that why two prim key class tags are existing in the ejb-jar.xml. Which is the possible way to code as such.
A Bean has to do transactions on multiple tables. Which is the best way to code in CMP?
I would be thankful if I get a suggestion.
Thank you,
Mallikarjun.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151263#4151263
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151263
More information about the jboss-user
mailing list