error java.rmi.RemoteException: EJB Exception:; nested exception is:
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.
How to know to which column in the database these two fields are mapped........
please tell me what could be wrong.....
VERY URGENT....
-
Doubt in CMP-RELationship (2 messages)
- Posted by: karthikeyan shanmugam
- Posted on: August 02 2002 04:28 EDT
Threaded Messages (2)
- Doubt in CMP-RELationship by J Virumbi on August 02 2002 05:09 EDT
- Doubt in CMP-RELationship by Owen Fellows on August 02 2002 07:16 EDT
-
Doubt in CMP-RELationship[ Go to top ]
- Posted by: J Virumbi
- Posted on: August 02 2002 05:09 EDT
- in response to karthikeyan shanmugam
Hi,
for any CMR field, u should have correspondinig setXXXEntity method.
(eg)
childEntityObject.setParentEntityObject(parentEntityObject);
Regular setXXX methods are only for cmp fields. -
Doubt in CMP-RELationship[ Go to top ]
- Posted by: Owen Fellows
- Posted on: August 02 2002 07:16 EDT
- in response to karthikeyan shanmugam
Hi,
I think you might be having a similar problem that i had.
If you are using EJB2.0 you can specify abstract gets and sets for all you CMP fields. You can also do the same for relationships.
e.g.
public abstract UserGroup getUserGroup();
public abstract void setUserGroup(com.theinagency.user.ejb.UserGroup userGroup);
In my case i wanted to use an email address to map a user to a user group table for access control.
So i though i will just create the relationship in the ejb-jar.xml mapping the email column to the primary key in the usergroup ejb. Because email was already a CMP field (which i wanted to keep) the server gave me a similar error.
I ended up creating another column just to be used a key which is identical to the email column. This isn't great but it works ok. Might have been simpler to remove the CMP mapping for the email field but i wanted a finder method on the email column.
Hope this helps.
Owen