The example you have pointed out is for 1- 1 relationship ..
I have an table A that can be related to multiple entries in table B .
If AA is the primary key in table A, table B has a primary-key call ( combination of two columns, one of which is AA and another one CC,which is a primary key in table C, that we are not concerned about right now .
Example -- .
I call the findByPrimaryKey of table A
By the relation with the table B , i get the collection of localObjects from table B...
Now, if i want to update the changed values in table B, i try to set in the values like this
tableBLocal.settableBCollections(Collection_tableBItems) --
I get the exception when i try to update the new line items
javax.ejb.EJBException: [EJB:010146]The setXXX method for a cmr-field that is mapped to a primary key may not be called. The cmr-field is read-only. Is there anything more i need to specify in deployment descriptors .
I am thinking relationship is fine, because i am eager loading the data and it seems to be working fine.
Also, is there anything i need to do in the ejbCreate() or ejbPostCreate()???
ejb-jar.xml
<ejb-relation>
<ejb-relation-name>GrieveNatureChecklist - GrievanceEJB</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>GrieveNatureChecklist has one GrievanceEJB</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>GrieveNatureChecklist</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>grievanceEJB_grieveSeqId</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>GrievanceEJB may have many GrieveNatureChecklist</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>GrievanceEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>grieveNatureChecklist_grieveSeqId</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
weblogic-cmp-rdbms-jar.xml
<relation-name>GrieveNatureChecklist - GrievanceEJB</relation-name>
<weblogic-relationship-role>
<relationship-role-name>GrieveNatureChecklist has one GrievanceEJB</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>GRIEVE_SEQ_ID</foreign-key-column>
<key-column>GRIEVE_SEQ_ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
GrievanceLocalHome home = (GrievanceLocalHome)EJBHomeFactory.getEJBLocalHome("GrievanceEJBLocal");
GrievanceLocal grievanceLocal = (GrievanceLocal)home.findByGrievanceId(new Long("1050"));
grievanceLocal.setResponseDate(timeStamp);
above code works fine
Collection grieveNatureCheckList = grievanceLocal.getGrieveNatureChecklist_grieveSeqId();
grievanceLocal.setGrieveNatureChecklist_grieveSeqId(grieveNatureCheckList); above code causes exception and fails .
Any Suggestions

[ January 27, 2005: Message edited by: Mohen Vijay ]