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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help me out for EJB2.0 CMR fields mapping in XDOCLET.......

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using CMR for EJB2.0 with JBOSS 4.0 as application server. Now I have 2 Beans CartMaster & CartDetail with one to Many relationship.
Now in Bean Implementation file i write following code in XDOCLET form.

CartMasterBean.java
========
/**
* @ejb.interface-method
* @ejb.relation name="cartmaster-to-cartdetail"
*
* role-name="CartMaster-has-many-CartDetail"
* target-ejb="ejb/CartMaster"
* target-role-name="CartDetail-has-one-CartMaster"
*
* @jboss.relation related-pk-field = "cartid"
fk-column = "cartdetailid"
* fk-constraint = "true"
* @return
*/

public abstract Collection getDetail();

/**
* @ejb.interface-method
*/
public abstract void setDetail(Collection c);

=======

CartDetailBean.java
=================
/**
* @ejb.interface-method
*
* @ejb.relation name="cartmaster-to-cartdetail"
* role-name="CartDetail-has-one-CartMaster"
* target-ejb="ejb/CartMaster"
* target-role-name="CartMaster-has-many-CartDetail"
*target-multiple = "true"
* @jboss.relation fk-column="cartid"
* related-pk-field="cartdetailid"
*
* @return
*/

public abstract CartMaster getParent();
/**
* @ejb.interface-method
*/
public abstract void setParent(CartMaster el);


=================


But when I run XDOCLET on it I m getting following code in My ejb-jar.xml inside <relationships > tag:-
=========
<relationships >
<ejb-relation >
<ejb-relation-name>cartmaster-to-cartdetail</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>CartDetail-has-one-CartMaster</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source >
<ejb-name>CartDetail</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>parent</cmr-field-name>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role >
<ejb-relationship-role-name>CartMaster-has-many-CartDetail</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>CartMaster</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>detail</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
=========

Here Problem is that I have specified the "cartid" & "cartdetailid" as Pk-field & foreign key fields in XDOCLET. But after running XDOCLET I am getting the CMR field names as "parent" & "detail" respectively. Why it is Happening? Also when I trying to deploy jar file on server It gives me error like:-
==================
12:20:57,437 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/CartDetail,service=EJB
org.jboss.deployment.DeploymentException: Role: CartDetail-has-one-CartMaster with multiplicity many using foreign-key mapping is not allowed to have key-fields
..............
===================

How to solve this?
Pleas ehelp me.

Thanx in Advance.......

Prash
 
Beware the other head of science - it bites! Nibble on this message:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic