File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes adding to CMR field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "adding to CMR field" Watch "adding to CMR field" New topic
Author

adding to CMR field

Matt Kim
Greenhorn

Joined: Mar 01, 2004
Posts: 26
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

Joined: Mar 01, 2004
Posts: 26
One more thing...
Why is it not enough simply to create the entity, why does it need to be added to the CMR collection?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding to CMR field