Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes CMR assignment rules... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "CMR assignment rules..." Watch "CMR assignment rules..." New topic
Author

CMR assignment rules...

Rekha Rao
Greenhorn

Joined: Jan 23, 2001
Posts: 15
In assignment rules for relationships (pg 154 of ejb spec)..

A and B are in one-to-one bidirectional relation..

a1 <--> b1
a2 <--> b2

changing:

a1.setB(a2.getB()) will result in

'a2.getB() == null'.

Suppose we just have:

a1.setB(b2) (that is, not accessing b2 through a2), will the container still be aware that b2 is involved with a2 and yield the same result ?
bhilla ratna
Ranch Hand

Joined: Jun 01, 2005
Posts: 59
In bean class cmp fields are not declared. But the getters and setters for cmp fields are declared. So, there is no way we can set
a1.set(b2);

bhilla


Ratna bhilla<br />SCJP 1.4, SCBCD 1.3, SCWCD 1.4
Praveen Kumar Mathaley
Ranch Hand

Joined: Apr 14, 2003
Posts: 45
can get to local reference to entity bean b in the entity bean a and set it
still container figures it out and makes the reference for other to null
[ August 18, 2005: Message edited by: Praveen Kumar Mathaley ]
chao cai
Ranch Hand

Joined: May 26, 2005
Posts: 154
yes,the same result.
a2.getB()==null,because the container will do it for us


SCEA<br />SCJP 1.2<br />SCBCD<br />MCSD<br />IBM Certified Specialist RUP v2003<br />IBM Certified Solution Designer OOAD vUML2<br /> <br />Phone Number:86-010-82776427
 
Consider Paul's rocket mass heater.
 
subject: CMR assignment rules...
 
Similar Threads
Setting to null an element of the many side of a relationship
kathy sierra question doubt
One to Many Bidirectional Relationship
How can I serialize thread handling with Java 5's java.util.concurrent package?
Assignment rules for relationships