01: package example;
02:
03: import javax.ejb.Entity;
04: import javax.ejb.Table;
05: import javax.ejb.Id;
06: import javax.ejb.Column;
07: import javax.ejb.GeneratorType;
08: import javax.ejb.Basic;
09: import static javax.ejb.GeneratorType.AUTO;
10: import static javax.ejb.AccessType.FIELD;
11:
12: /**
13: * Local interface for a course taught at Hogwarts, providing
14: * methods to view and change it.
15: *
16: * <code><pre>
17: * CREATE TABLE ejb3_basic_courses (
18: * id INTEGER
19: * course VARCHAR(250),
20: * teacher VARCHAR(250),
21: *
22: * PRIMARY KEY(course_id)
23: * );
24: * </pre></code>
25: */
26: @Entity(access=FIELD)
27: @Table(name="ejb3_xa_courses")
28: public class Course {
29: @Id(generate=AUTO)
30: @Column(name="id")
31: private int _id;
32:
33: @Basic
34: @Column(name="course")
35: private String _course;
36:
37: @Basic
38: @Column(name="teacher")
39: private String _teacher;
40:
41: /**
42: * Returns the ID of the course.
43: */
44: public int getId() {
45: return _id;
46: }
47:
48: public void setId(int id) {
49: _id = id;
50: }
51:
52: /**
53: * Returns the course name.
54: */
55: public String getCourse() {
56: return _course;
57: }
58:
59: /**
60: * Sets the course name.
61: */
62: public void setCourse(String course) {
63: _course = course;
64: }
65:
66: /**
67: * Returns the teacher name.
68: */
69: public String getTeacher() {
70: return _teacher;
71: }
72:
73: /**
74: * Sets the teacher name.
75: */
76: public void setTeacher(String teacher) {
77: _teacher = teacher;
78: }
79: }
|