KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > cmp > one2many > StudentBean


1 package example.cmp.one2many;
2
3 /**
4  * Implementation class for the Student bean.
5  *
6  * <p>Each instance of StudentBean
7  * maps to a table entry of "one2many_students", where student is defined.
8  *
9  * <p>StudentBean is abstract since it's taking advantage of container-managed
10  * persistence. Resin-CMP will create the implementation of the abstract
11  * methods.
12  *
13  * <p>StudentBean also takes advantage of the AbstractEntityBean
14  * implementation. AbstractEntityBean is just a stub
15  * EntityBean implementation with default methods to make life
16  * a little more sane for simple beans.
17  *
18  * <p>This CMP bean uses the following schema:
19  *
20  * <code><pre>
21  * CREATE TABLE one2many_students (
22  * name VARCHAR(250) NOT NULL,
23  * house VARCHAR(250),
24  *
25  * PRIMARY KEY(name)
26  * );
27  * </pre></code>
28  */

29 abstract public class StudentBean extends com.caucho.ejb.AbstractEntityBean {
30   /**
31    * Returns the name of the student (CMP field). The name is also the primary
32    * key as defined in the deployment descriptor.
33    */

34   abstract public String getName();
35   /**
36    * Returns the <code>House</code> that the student belongs to (CMR field).
37    * <p>This method needs to exist
38    * because the field <code>house</code> is defined as a CMR field.
39    */

40   abstract public House getHouse();
41   /**
42    * Sets the <code>House</code> that the student belongs to (CMR field).
43    * This method needs to exist
44    * because the field <code>house</code> is defined as a CMR field.
45    */

46   abstract public void setHouse(House house);
47 }
48
Popular Tags