example.cmp.id
Class QuidditchBean

example.cmp.id.QuidditchBean

public abstract class QuidditchBean

Implementation class for the Quidditch bean.

Each instance of QuidditchBean maps to a table entry of "id_quidditch".

The Quidditch entry is tied to a Student, using the Student as its primary key.

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

StudentBean 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.

This CMP bean uses the following schema:

 CREATE TABLE id_quidditch (
   student VARCHAR(250) NOT NULL REFERENCES id_student(name),

   position VARCHAR(250),
   points INTEGER,

   PRIMARY KEY(student)
 );
 


Constructor Summary
QuidditchBean()
           
 
Method Summary
 Student ejbCreate(Student student, java.lang.String position)
          Creates the student's scores, setting primary keys and fields.
 void ejbPostCreate(Student student, java.lang.String position)
          Sets any relations.
abstract  int getPoints()
          Returns the number of points the student has earned.
abstract  java.lang.String getPosition()
          Returns the position the student plays on the team.
abstract  Student getStudent()
          Returns the owning student.
abstract  void setPoints(int points)
          Sets the number of points the student has earned.
abstract  void setPosition(java.lang.String position)
          Sets the position the student plays on the team.
abstract  void setStudent(Student student)
          Sets the owning student.
 

Constructor Detail

QuidditchBean

public QuidditchBean()
Method Detail

getStudent

public abstract Student getStudent()
Returns the owning student. The student is also the primary key.

setStudent

public abstract void setStudent(Student student)
Sets the owning student. Since the student is the primary key, this method is only called from the ejbCreate method.

getPosition

public abstract java.lang.String getPosition()
Returns the position the student plays on the team.

setPosition

public abstract void setPosition(java.lang.String position)
Sets the position the student plays on the team.

getPoints

public abstract int getPoints()
Returns the number of points the student has earned.

setPoints

public abstract void setPoints(int points)
Sets the number of points the student has earned.

ejbCreate

public Student ejbCreate(Student student,
                         java.lang.String position)
                  throws javax.ejb.CreateException
Creates the student's scores, setting primary keys and fields.

ejbPostCreate

public void ejbPostCreate(Student student,
                          java.lang.String position)
Sets any relations. This case has no relations.