I have a doubt about CMR example (Page 396, Head First
EJB, MovieBean code).
Movie bean has a CMR field directorID. In the relational database schema, directorID is a foreign key in the Movie table. ejbCreate method in Movie bean takes directorID as a parameter but it is not set using abstract CMP methods being a CMR field. If a record is inserted in Movie table by container after completion of ejbCreate, is directorID attribute for that record set to null? What if there is a NOT NULL constraint on directorID column of the Movie table?
The setDirector is called during ejbPostCreate to link the Movie Bean with the Director Bean at this point who is responsible for updating the foreing key(Movie.directorID) in the underlying database?
If a client gets a reference to an existing Movie bean by calling a finder method, how does container establish the link between Movie and Director bean since directorID is not being supplied from client in this case?
thanks
Devendra