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.
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>
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 .............. ===================