Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

deployment exception with compound primary key in jboss3.0 getUniqueChild exception

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well i am facing problem when relating to customer to phone.I have defined primary key of phone as compund.I am using jboss3.0
Application= ,J2EEServer=Single,j2eeType=EJBModule,name=sh.jar
20:06:44,231 ERROR [EjbModule] Initialization failed
org.jboss.deployment.DeploymentException: expected one strategy tag
at org.jboss.metadata.MetaData.getUniqueChild(MetaData.java:95)
at org.jboss.metadata.MetaData.getUniqueChildContent(MetaData.java:198)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData.<init>(JDBCR
eadAheadMetaData.java:109)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEnti
tyMetaData.java:512)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDB
/////////////////////////////////////////////////
Here is my ejb-jar.xml
//////////////////////////////////////////////////
<?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>
<!--CUSTOMER EJB-->
<entity>
<ejb-name>CustomerEJB</ejb-name>
<remote>com.ssuet.customer.Customer</remote>
<home>com.ssuet.customer.CustomerHome</home>
<ejb-class>com.ssuet.customer.CustomerBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Customer</abstract-schema-name>
<cmp-field>
<field-name>firstName</field-name>
</cmp-field>
<cmp-field>
<field-name>lastName</field-name>
</cmp-field>
<cmp-field>
<field-name>userID</field-name>
</cmp-field>
<cmp-field>
<field-name>userPwd</field-name>
</cmp-field>
<cmp-field>
<field-name>emailAddress</field-name>
</cmp-field>

<primkey-field>userID</primkey-field>

<ejb-local-ref>
<ejb-ref-name>ejb/PhoneHomeLocal</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.ssuet.phone.PhoneHomeLocal</local-home>
<local>com.ssuet.phone.PhoneLocal</local>
<ejb-link>PhoneEJB</ejb-link>
</ejb-local-ref>

</entity>

<!--PHONE EJB-->
<entity>
<ejb-name>PhoneEJB</ejb-name>
<local>com.ssuet.phone.PhoneLocal</local>
<local-home>com.ssuet.phone.PhoneHomeLocal</local-home>
<ejb-class>com.ssuet.phone.PhoneBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.ssuet.phone.PhonePK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Phone</abstract-schema-name>
<cmp-field>
<field-name>countryCode</field-name>
</cmp-field>

<cmp-field>
<field-name>areaCode</field-name>
</cmp-field>
<cmp-field>
<field-name>phoneNo</field-name>
</cmp-field>
</entity>
</enterprise-beans>
<relationships>

<!--One-to-Many Customer-Phone-->
<ejb-relation>
<ejb-relation-name>Customer-Phone</ejb-relation-name>
<!--defining relation ship of customer-->
<ejb-relationship-role>
<ejb-relationship-role-name>Customer-has-Phone</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>phoneNumbers</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<!--defining relationship of phone-->
<ejb-relationship-role>
<ejb-relationship-role-name>Phone-belongs-to-Customer</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>PhoneEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>
</ejb-jar>

//////////////////////////////////////////////////
////////////////////////////////////////////////
jboss-cmpjdnc.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc>
<!-- ===================================================================== -->
<!-- -->
<!-- Standard JBossCMP-JDBC Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id: standardjbosscmp-jdbc.xml,v 1.23.2.5 2002/05/21 14:51:41 starksm Exp $ -->
<jbosscmp-jdbc>
<enterprise-beans>
<entity>
<ejb-name>CustomerEJB</ejb-name>
<table-name>CustomerEJB</table-name>
<datasource>java:/DefaultDS</datasource>
<type-mapping>Hypersonic SQL</type-mapping>
<debug>true</debug>
<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<time-out>300</time-out>
<select-for-update>false</select-for-update>
<pk-constraint>false</pk-constraint>
<read-ahead>true</read-ahead>
<cmp-field>
<field-name>firstName</field-name>
<column-name>FIRST_NAME</column-name>
</cmp-field>
<cmp-field>
<field-name>lastName</field-name>
<column-name>LAST_NAME</column-name>
</cmp-field>
<cmp-field>
<field-name>userID</field-name>
<column-name>USER_ID</column-name>
</cmp-field>
<cmp-field>
<field-name>userPwd</field-name>
<column-name>USER_PWD</column-name>
</cmp-field>
<cmp-field>
<field-name>emailAddress</field-name>
<column-name>EMAIL_ADDRESS</column-name>
</cmp-field>

</entity>
<entity>
<ejb-name>PhoneEJB</ejb-name>
<table-name>PhoneEJB</table-name>
<datasource>java:/DefaultDS</datasource>
<type-mapping>Hypersonic SQL</type-mapping>
<debug>true</debug>
<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<time-out>300</time-out>
<select-for-update>false</select-for-update>
<pk-constraint>false</pk-constraint>
<read-ahead>true</read-ahead>
<cmp-field>
<field-name>countryCode</field-name>
<column-name>COUNTRY_CODE</column-name>
</cmp-field>

<cmp-field>
<field-name>areaCode</field-name>
<column-name>AREA_CODE</column-name>
</cmp-field>
<cmp-field>
<field-name>phoneNo</field-name>
<column-name>PHONE_NO</column-name>
</cmp-field>

</entity>

</enterprise-beans>
<relationships>
<ejb-relation>
<!--One-to-Many Customer-Order-->
<ejb-relation-name>Customer-Phone</ejb-relation-name>
<foreign-key-mapping>
<!--defining relation ship of customer-->
<ejb-relationship-role>
<ejb-relationship-role-name>Customer-has-Phone</ejb-relationship-role-name>
<foreign-key-fields>
<foreign-key-field>
<field-name>countryCode</field-name>
<column-name>COUNTRY_CODE</column-name>
</foreign-key-field>
<foreign-key-field>
<field-name>areaCode</field-name>
<column-name>AREA_CODE</column-name>
</foreign-key-field>
<foreign-key-field>
<field-name>phoneNo</field-name>
<column-name>PHONE_NO</column-name>
</foreign-key-field>
</foreign-key-fields>

</ejb-relationship-role>
<!--defining relationship of order-->
<ejb-relationship-role>
<ejb-relationship-role-name>Phone-belongs-to-Customer</ejb-relationship-role-name>
<foreign-key-fields/>
</ejb-relationship-role>
</foreign-key-mapping>
</ejb-relation>
</relationships>
</jbosscmp-jdbc>
//////////////////////////////////////////////////
I have make every possible combination of foriegn key but can not solve it please it will be very great for me if some one solve this problem please.
Jawwad Ahmed
 
reply
    Bookmark Topic Watch Topic
  • New Topic