Hey all.
I need your help please.
I have two CMP beans, PlayerBean and TeamBean.
the relationship is one to many and unidirectional.
TeamBean has a CMR field called plalyers and PlayerBean has a CMR field called team.
the database schema for TeamBean is :
name, city
the database schema for Player bean is :
id, fullname, name // name is the name of the city
when designing my database, I didn't specify the name field in PlayerBean table as a FK and it is nullable ( I am allowing that a player can exists without a team)
PlayerBean has the following ejbCreate( ) method :
but I have read a note that says :
you must set the CMR field at the ejbPostCreate( ) like this :
I am now confused, which approach is right ?
someone told me that if you designed your name field in Player table as NOT a FK , then you can use the first approach.
and I you set the name field in Player table, then you must use the second approach (setting the CMR field in ejbPostCreate( )).
enlight me please, I am confused.