KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > Course


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

19 @Entity
20 @Table(name="amber_resin_xa_courses")
21 public class Course {
22   @Id
23   @Column(name="id")
24   @GeneratedValue
25   private int _id;
26   
27   @Basic
28   @Column(name="course")
29   private String JavaDoc _course;
30   
31   @Basic
32   @Column(name="teacher")
33   private String JavaDoc _teacher;
34
35   /**
36    * Returns the ID of the course.
37    */

38   public int getId()
39   {
40     return _id;
41   }
42   
43   public void setId(int id)
44   {
45     _id = id;
46   }
47
48   /**
49    * Returns the course name.
50    */

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   public String JavaDoc getTeacher()
68   {
69     return _teacher;
70   }
71
72   /**
73    * Sets the teacher name.
74    */

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