This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

CMP entity bean bi-directional / local view

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,
I read a book , it says this "a CMP entity bean can have bi-directional relationship with other entity beans IF AND ONLY IF it provides local component interface " What is its meaning ? Why?
let's say, A <----> B has bi-directional relationship, so A should AT LEAST local view, B is same.
Am I right? why?
Thanks.
Edward
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Bidirectional relationship means Many-Many relationships.
Read EJB specs pdf for EJB 2.0 or 2.1 to get more details.
Seetesh
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Edward Chen:
"a CMP entity bean can have bi-directional relationship with other entity beans IF AND ONLY IF it provides local component interface " What is its meaning ? Why?
let's say, A <----> B has bi-directional relationship, so A should AT LEAST local view, B is same.


A source entity bean X can have a relationship with another target entity bean Y, only if target entity bean Y has local interfaces.
In the similar way, if entity bean Y would like to have relationship with X, then X should have local interfaces. Is it confusing?
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I check the spec. In the Page 137, it has "One-to-one bidirectional relationship". in the page 131, it says bidirectional just mean it can navigate both ways. So, I think your point is not right.
please correct me.
Thanks.
Edward
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Vish, thanks for your responses. But why? what about a target bean is in the remote another server ?
Thanks
Edward
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Edward Chen:
Hi, Vish, thanks for your responses. But why? what about a target bean is in the remote another server ?
Thanks
Edward


That's precisely what the spec is trying to avoid, the overhead of navigating a bi-di relationship over the network. If I use bean X to get an instance of bean Y and make changes, this is trivial to maintain. In a bi-di relationship I can use bean X to get an instance of bean Y and then use bean Y to get an instance of bean X. This is a monster to manage unless the assumption can be made that all of this is being done locally. And that part of the spec allows the EJB container developers to make that assumption.
Hope this clears it up for you.
Michael
ps read my post here to learn why you most likely shouldn't be developing entity beans.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The spec doesn't allow us to maintain entity bean relationships for remote interfaces, atleast not in ver EJB2.0.
for example:
We cannot have an OrderEJB running on machine A to have a bi-directional relationship with OrderLinesEJB running on machine B at a different location.
I liked this interesting discussion :
http://www.theserverside.com/discussions/thread.jsp?thread_id=13664
 
Michael D. Brown
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you like that thread, check out my treatise on excluding entity beans from all in house (ie not a packaged app) development right here.
[ February 24, 2004: Message edited by: Michael D. Brown ]
[ February 24, 2004: Message edited by: Michael D. Brown ]
 
    Bookmark Topic Watch Topic
  • New Topic