This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Help me out for CMR deployment in CMP EJB...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Help me out for CMR deployment in CMP EJB......" Watch "Help me out for CMR deployment in CMP EJB......" New topic
Author

Help me out for CMR deployment in CMP EJB......

Pras Tiwari
Ranch Hand

Joined: Nov 07, 2005
Posts: 186
hi,

I am using JBOSS4.0 for my CMP2.0 EJB's. I ve two EJB's having one to many CMR betn them(CartMaster---->CartDetail). When I m deploying these beans under server I m getting error:--
========
11:59:06,109 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/CartDetail,service=EJB
org.jboss.deployment.DeploymentException: Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey-field> is missing from ejb-jar.xml): ejb-relation-name=cartdetailInAcartmasterRelation

========

My ejb-jar.xml is:-
======
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<entity >
<description><![CDATA[Description for CartDetail]]></description>
<display-name>Name for CartDetail</display-name>

<ejb-name>CartDetail</ejb-name>

<home>econify.cartdetail.interfaces.CartDetailHome</home>
<remote>econify.cartdetail.interfaces.CartDetail</remote>
<local-home>econify.cartdetail.interfaces.CartDetailLocalHome</local-home>
<local>econify.cartdetail.interfaces.CartDetailLocal</local>

<ejb-class>econify.cartdetail.ejb.CartDetailCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>econify.cartdetail.interfaces.CartDetailPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CartDetail</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>cartdetailid</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>cartid</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>partid</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>quantity</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>unitprice</field-name>
</cmp-field>
</entity>

<entity >
<ejb-name>CartMaster</ejb-name>
<home>econify.cartmaster.interfaces.CartMasterHome</home>
<remote>econify.cartmaster.interfaces.CartMaster</remote>
<local-home>econify.cartmaster.interfaces.CartMasterLocalHome</local-home>
<local>econify.cartmaster.interfaces.CartMasterLocal</local>

<ejb-class>econify.cartmaster.ejb.CartMasterCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>econify.cartmaster.interfaces.CartMasterPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CartMaster</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>cartdate</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>cartid</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>customerid</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>status</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>totalvalue</field-name>
</cmp-field>

<query>
<description><![CDATA[]]></description>
<query-method>
<method-name>ejbSelectmaxcartid</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT MAX(cms.cartid) FROM CartMaster AS cms]]></ejb-ql>
</query>
</entity>
</enterprise-beans>

<!-- Relationships -->
<relationships >
<ejb-relation >
<ejb-relation-name>cartdetailInAcartmasterRelation</ejb-relation-name>

<ejb-relationship-role >
<ejb-relationship-role-name>cartdetailIncartmaster</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>CartDetail</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>cartmaster</cmr-field-name>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role >
<ejb-relationship-role-name>cartmasterHascartdetails</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CartMaster</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>cartdetails</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>

</ejb-relation>

</relationships>

<assembly-descriptor >

<container-transaction >
<method >
<ejb-name>CartDetail</ejb-name>
<method-intf>Local</method-intf>
<method-name>getCartmaster</method-name>
<method-params>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>CartMaster</ejb-name>
<method-intf>Local</method-intf>
<method-name>getCartdetails</method-name>
<method-params>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>

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

========

& jbosscmp-jdbc.xmml is:-
=====
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>CartDetail</ejb-name>
<jndi-name>ejb/CartDetail</jndi-name>
<local-jndi-name>CartDetailLocal</local-jndi-name>
<method-attributes>
</method-attributes>
</entity>
<entity>
<ejb-name>CartMaster</ejb-name>
<jndi-name>ejb/CartMaster</jndi-name>
<local-jndi-name>CartMasterLocal</local-jndi-name>
<method-attributes>
</method-attributes>
</entity>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
<resource-managers>
</resource-managers>
</jboss>

========

Pls help me regarding above error.
Thanx,

Prash


********Deserve Before You Desire********
 
Don't get me started about those stupid light bulbs.
 
subject: Help me out for CMR deployment in CMP EJB......
 
Similar Threads
WebSphere V5 CMP create problem
Error in ejb-jar.xml
weblogic mapping with Oracle failed
Error in EJB2.0 CMR Deployment
EJB PK class