posted 21 years ago
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.