posted 20 years ago
Hi,
Following doubts may sound silly, but still I am confused about them. Please help me to understand them.
If there are 2 entity types Movie and Director and they have 2 way CMR. As in HFEJB, every movie can have 1 director and director can drect 0..* movies. Let us assume entities movie1 and director1 of entity types Movie and Director. Here are my doudbts.
1) If movie1.setDirector(director1) is called, movie referes to director, in this case, will director1 automatically referes to movie1? i.e Will container set the relation in opposite direction or the client has to do it?
2) If director has to add/remove movie relations, getting the movie collection by director1.getMovies() and then adding/deleting movies to/from that collection object will automatically set/unset relations in the underlying entities(DB rows) automatically by the container?
3) If director1 is referring to movie7 and movie8 already, calling director.setMovies(null) will do what? Will it empty the movie collection object in director1 or will it make the reference to movie collection object in director1 as null?
4) If director1 is referring to movie7 and movie8 already, calling director.setMovies() with a collection object having movie3 and movie 4. After this will movie collection object in director1 have movie7, movie8, movie3 and movie 4? Or will movie collection object in director1 have movie3 and movie 4 only? i.e will it append or replace existing relations?
Thanks for your time,
Phani
IBM 486 (OOAD/UML)<br />SCJP 1.4<br />SCBCD<br />SCWCD<br />IBM WebSPhere Cert Admin (IBM-340)<br />Gonna prepare for WebLogic Cert