example.cmp.relation_n_1
Class HouseBean

example.cmp.relation_n_1.HouseBean

public abstract class HouseBean

Implementation of the HouseBean. Each instance of HouseBean maps to a table entry of "student_house", where student_house is defined as

 CREATE TABLE student_house (
   name VARCHAR(250),
   points INTEGER
 )
 

HouseBean is abstract since it's taking advantage of container-managed persistence. Resin-EJB 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  int getPoints()
          Returns the number of points for the house.
abstract  java.util.Collection getStudentList()
          Returns a collection of the students.
 java.util.Collection getStudents()
          Return a new ArrayList of the students since entity beans can't directly return the persistent collection.
 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.

getPoints

public abstract int getPoints()
Returns the number of points for the house.

getStudentList

public abstract java.util.Collection getStudentList()
Returns a collection of the students.

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.

getStudents

public java.util.Collection getStudents()
Return a new ArrayList of the students since entity beans can't directly return the persistent collection.