File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes CMR in CMP Entity Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMR in CMP Entity Beans" Watch "CMR in CMP Entity Beans" New topic

CMR in CMP Entity Beans

rastin purr
Ranch Hand

Joined: Jul 20, 2002
Posts: 73
Hi All,
We could define a relationship between cmp entity beans, say one to many relationship. Lets say, Orders could have many LineItems but each LineItems could only belongs to an Orders. Set the relationship tag in ejb-jar.xml
The Orders bean would have methods like say, for example,
public abstract Collection getLineItems();
public abstract void setLineItems(Collection);
and the LineItems bean would have methods like say again for example,
public abstract Orders getOrders();
public abstract void setOrders(Orders orders);
or it could be like below for local
public abstract LocalOrders getOrders();
public abstract void setOrders(LocalOrders localOrders);

I am a bit confused. How does the container knows which mode the local or remote to be returned in the case of the Orders bean. And in the case of the LineItems bean, the Collection returned, how is one supposed to know if the collection is made up of local or remote interfaces?
Or am I all wrong such that only local interfaces are allowed when realtionship are concerned in CMP entity beans?
Please advice. Any ideas and comments are welcomed. Thanks in advance.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Relations are only supported for local interfaces

rastin purr
Ranch Hand

Joined: Jul 20, 2002
Posts: 73
Thanks Pradeep,
Is relationship only supported in local, is it starting from j2ee1.3 and ejb2.0?
Kalpesh Soni
Ranch Hand

Joined: Jan 02, 2001
Posts: 312
as fas as possible user local interfaces with entity beans!
and I think, for unidirectional relationship, local interfaces are not a must
anybody ? comment

Test 094, IBM WID 6.0 cert
SCJP 1.2
SCBCD 1.3 Beta
SCWCD 1.4 Beta

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

TO quote from ejb spec
"Container-managed relationships
can exist only among entity beans within the same local relationship
scope, as defined by the relationships element in the deployment descriptor. Container-managed
relationships are defined in terms of the local interfaces of the related beans."
If I am not wrong BEA weblogic server 7.0 supports relationships for remote interfaces.
Future versions of EJB may also support this feature.
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
I don't think there's much of a chance that later EJB versions will support remote relationships. The semantics of how to handle cache scoping across JVM boundaries is tricky to say the least.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: CMR in CMP Entity Beans
It's not a secret anymore!