Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMR fields One to Many relationships

 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we have a One to Many relationship, say a Director with it's Movies, we can do the following:

movie1.setDirector(movie2.getDirector());

In this case, the container will MOVE movie1's reference from the current collection and place it in the collection where movie2 is found. Great.

But, i don't quite understand what is ment by saying that in this case the director reference is COPIED from one movie to another.

This example is clearer in HFEJB page 422.

Regards.
 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone clarify this?
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>>In this case, the container will MOVE movie1's reference from the current collection and place it in the collection where movie2 is found. Great.

But, i don't quite understand what is ment by saying that in this case the director reference is COPIED from one movie to another.
<<<

It is 'copied' only, as other movie can also belong to that director.

In the first case, the movie is 'moved' as no other director would have that movie anymore-only 1.
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesus Angeles,
I agree with you. COPYing reference means Movie2 will have the same director reference as well as Movie1.

Thanks,
Ugender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic