example.cmp.relations.one2many
Class HouseBean

example.cmp.relations.one2many.HouseBean

public abstract class HouseBean

Implementation of the HouseBean. Each instance of StudentBean maps to a table entry of "one2many_houses", where student is defined.

HouseBean is abstract since it's taking advantage of container-managed persistence. Resin-CMP will create the implementation of the abstract methods.

HouseBean also takes advantage of the AbstractEntityBean implementation. AbstractEntityBean is just a stub EntityBean implementation with default methods to make life a little more sane for simple beans.


Constructor Summary
HouseBean()
           
 
Method Summary
 void addStudent(Student student)
          Adds a student to the house.
abstract  java.lang.String getName()
          Returns the house name.
abstract  java.util.Collection getStudentList()
          returns all Students.
 void removeStudent(Student student)
          Removes a student from the house.
 

Constructor Detail

HouseBean

public HouseBean()
Method Detail

getName

public abstract java.lang.String getName()
Returns the house name. The name is the primary key as defined in the deployment descriptor.

getStudentList

public abstract java.util.Collection getStudentList()
returns all Students. This method needs to exist because the field studentList is defined as a CMR field.

addStudent

public void addStudent(Student student)
Adds a student to the house. If the student is already a member of another house, he will be removed from that house automatically.

removeStudent

public void removeStudent(Student student)
Removes a student from the house.