File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB unidirectional CMR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB unidirectional CMR" Watch "EJB unidirectional CMR" New topic
Author

EJB unidirectional CMR

Vladas Razas
Ranch Hand

Joined: Dec 02, 2003
Posts: 385
Hi,
How should I implement unidirectional relationship? Let's say I have this kind of relationship (btw from page 432):
Foo (0-1) -> Bar (0-1)
Do I have to have CMR fields in both Foo and Bar? If so then what does "unidirectional relationship" means in terms of implementation? Or maybe the only difference is I do not put Foo accessor methods into Bar class remote(or local) interface(s). In that case... does it makes any difference is it unidirectional or bidirectional to container?
My best regards
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Vladas,
The <cmr-field> element is optional. To describe a unidirectional relationship, you simply define a <cmr-field> in *only one* of both <ejb-relationship-role> elements.
Best,
Phil.
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3178
    
    3
Hi, Vladas,
Let's look at relationship Customer-HomeAddress.
Customer must know his/her address, but Address does not need to know anything about it's customer.
Here is the piece of DD for this relationship:

It was taken from SCBCD Study Guide web-site.
As you can see, Address definition does not have cmr-field element. This means, Address have no idea about customer (the relation is unidirectional)
This and much-much more you can find there
Cheers!!!


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Vladas Razas
Ranch Hand

Joined: Dec 02, 2003
Posts: 385
Thanks !
And likewise if I don't have CMR field it means I do NOT put abstract setter/getter for it
Nice site Mikalai! Now I see that bean with only remote interface may only have unidirectional relationship from one side.
My best regards
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3178
    
    3

Now I see that bean with only remote interface may only have unidirectional relationship from one side.

yeah, you are absolutely right, bean with only Remote interface
can have [unidirectional] relationship to other bean (with local interface), but nobody can access it in CMR.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB unidirectional CMR
 
Similar Threads
QNo. 4 Ch-6 Coffee Cram Mock Exam!!
HFEJB - question page 426 - # 4.
HFE page 426
Mock Question HFEJB page 426. Q4.
unidirectional relationship