Daniel, I read the section you pointed out. I did not find either how it is
related to my problem and how your solution solves my problem.

in "entityBRef.getREntityA().add(entityARef)", is entityARef an existing
Bean A instance initialized with PK? Then when/how did that XXX field
INITIALIZED?

I'm a little slow. Please give me details. Thanks!



-----Original Message-----
From: Daniel De Luca [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 4:08 AM
To: [EMAIL PROTECTED]
Subject: RE: An CMR related exception


Alvin,

Yes that's right.
Why? Well that's how the specs are defined and how the App Server
container have to do things.
Check the EJB 2.0 specs for more details: 10.3.8 Collections managed by
the Container, 10.3.6 Semantics of assignment for relationships

Daniel

-----Original Message-----
From: Alvin Wang [mailto:[EMAIL PROTECTED]]
Sent: samedi 9 mars 2002 2:23
To: Daniel De Luca; [EMAIL PROTECTED]
Subject: RE: An CMR related exception


Deniel, thanks for replying. Do you mean
"entityBRef.getREntityA().add(entityARef)" will initialize that field?
Why? Or when and how that field will be initialized in later time?
Please give more details!

Thanks!


-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Daniel De Luca
Sent: Friday, March 08, 2002 11:58 AM
To: [EMAIL PROTECTED]
Subject: Re: An CMR related exception


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

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

Reply via email to