• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

confusion over the EJB spec.

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Rancher
Posts: 3620
38
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Big Thanks for everyone's replies!
-lev
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic