Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding to CMR field

 
Matt Kim
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm very new to J2EE. I understand that with EJBs, things must be looked at from an "Object" point of view.
My question is, in the Sun J2EE Roster App tutorial, why does the "Player" need to be added to the Collection of "Players" in a "Team"? From an OO point of view, it makes sense, however, from a persistent data (database) point of view it's not too clear to me. (Code provided below).
Does this mean that if a DB is populated with data before the container is started, the container auto-fills the CMR fields?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void addPlayer(LocalPlayer player) {
try {
Collection players = getPlayers();
players.add(player);
} catch (Exception ex) {
throw new EJBException(ex.getMessage());
}
}
Thanks in advance,
Matt
 
Matt Kim
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing...
Why is it not enough simply to create the entity, why does it need to be added to the CMR collection?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic