Alvin, You can't apply a Set method on a cmp-field that is used in a relationship between 2 entities. You don't necessarily need to initialize that field in the ejbCreate method. What you have to do is create the Entity bean and initialize only the PK.
Then suppose EntityA has a relation with EntityB and the CMR fields are rEntityB (in EntityA) and rEntityA (in EntityB) In order to "set" the relationship between the 2 you need to use the entityBRef.getREntityA().add(entityARef). After that your CMP-field will be up to date. I would suggest you to read the EJB 2.0 Spec, everything is explained there. Hope this help. Daniel -----Original Message----- From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Alvin Wang Sent: vendredi 8 mars 2002 16:12 To: [EMAIL PROTECTED] Subject: An CMR related exception Hi! I am using Weblogic 6.1 SP2 and EJB 2.0. I built a CMR between two Entity Beans. However, I got the following exception while running: "javax.ejb.EJBException: When a cmp-field and a cmr-field (relationship) are mapped to the same column, the setXXX method for the cmp-field may not be called. The cmp-field is read-only." However, in the ejbCreate() method in CMP in EJB 2.0, I have to use setXXX method to initialize the XXX cmp-field. Am I wrong? Can any guru help? thanks! ======================================================================== === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
