• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

confusion over the EJB spec.

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all. Happy New Year. I have a question, maybe someone can privide some insight into this.
The spec says (page 138): Once an entity has been removed from a relationship, the accessor methods for any relationships to the entity will reflect this removal. An accessor method for a one-to-one or many-to-one relationship to the entity will return null; and an accessor method for a many-to-many relationship to the entity will return a collection from which the entity object has been removed.
1) First of all, what's the direction of the relationship they are talking about? It wouldn't matter for one-to-one, but what about many-to-one? Is it from the bean that's removed to the other bean??? What about one-to-many, how come it is not mentioned at all in that paragraph?
2) If bean A is in the many-to-one relationship with bean B (i am thinking many beans A are contained by 1 bean B and only 1 bean B is contained by 1 bean A, just like the Movies-Director example from Kathy's book) and bean A gets removed, then how come the accessor for bean A in bean B (according to the spec) will return a null, and only if these two guys were in the many-to-many relationship would it return the collection from which A came from? I thought that in the many-to-one case the accessor for bean A in bean B would also return the collection of As (without the removed instance of A in my example)...
I would greately appreciate any help. This is driving me nuts. I cant resolve this point. thanks MUCH!
-lev g.
 
lev grevnin
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys. Please disregard my previous posting. It's way too confusing and all over the place, plus i have solved most of this. My question for now is this: how come in the specification exerpt mentioned in my previous posting they don't discuss the one-to-many relationship case? I believe, that an accessor method for one-to-many relationship to the entity will as well return a collection from which the entity object has been removed. Can someone comment on that please. Thanks -lev
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lev,

how come in the specification exerpt mentioned in my previous posting they don't discuss the one-to-many relationship case?


I guess that after having explained the many-to-one case, it was obvious to them that the opposite way is similar. It's just a question of point of view.
Regards,
Phil.
 
Bartender
Posts: 3725
39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by lev grevnin:
Guys. Please disregard my previous posting. It's way too confusing and all over the place, plus i have solved most of this. My question for now is this: how come in the specification exerpt mentioned in my previous posting they don't discuss the one-to-many relationship case? I believe, that an accessor method for one-to-many relationship to the entity will as well return a collection from which the entity object has been removed. Can someone comment on that please. Thanks -lev


howdy, here you can find detailed explanation of CMR for Entity Beans.
 
lev grevnin
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Big Thanks for everyone's replies!
-lev
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic