KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > CourseBean


1 package example;
2
3 import javax.persistence.Basic;
4 import javax.persistence.Column;
5 import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id;
8 import javax.persistence.Table;
9
10 /**
11  * Local interface for a course taught at Hogwarts, providing
12  * methods to view and change it.
13  *
14  * <code><pre>
15  * CREATE TABLE ejb3_basic_courses (
16  * id INTEGER
17  * course VARCHAR(250),
18  * teacher VARCHAR(250),
19  *
20  * PRIMARY KEY(course_id)
21  * );
22  * </pre></code>
23  */

24 @Entity
25 @Table(name="ejb3_basic_courses")
26 public class CourseBean {
27   private int _id;
28   private String JavaDoc _course;
29   private String JavaDoc _teacher;
30   
31   /**
32    * Returns the ID of the course.
33    */

34   @Id
35   @Column(name="id")
36   @GeneratedValue
37   public int getId()
38   {
39     return _id;
40   }
41   
42   public void setId(int id)
43   {
44     _id = id;
45   }
46
47   /**
48    * Returns the course name.
49    */

50   @Basic
51   public String JavaDoc getCourse()
52   {
53     return _course;
54   }
55
56   /**
57    * Sets the course name.
58    */

59   public void setCourse(String JavaDoc course)
60   {
61     _course = course;
62   }
63
64   /**
65    * Returns the teacher name.
66    */

67   @Basic
68   public String JavaDoc getTeacher()
69   {
70     return _teacher;
71   }
72
73   /**
74    * Sets the teacher name.
75    */

76   public void setTeacher(String JavaDoc teacher)
77   {
78     _teacher = teacher;
79   }
80 }
81
Popular Tags