KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > entitytest03 > Course


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Course.java 975 2006-07-28 11:14:14Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest03;
26
27 import java.util.Collection JavaDoc;
28
29 import javax.persistence.Entity;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.OneToMany;
34 import javax.persistence.TableGenerator;
35
36 /**
37  * The course that ccan have many classes.
38  * @author Gisele Pinheiro Souza
39  * @author Eduardo Studzinski Estima de Castro
40  *
41  */

42 @Entity
43 public class Course {
44
45     /**
46      * The identifier.
47      */

48     private Long JavaDoc courseId;
49
50     /**
51      * The course name.
52      */

53     private String JavaDoc name;
54
55     /**
56      * The number of credits.
57      */

58     private int credits;
59
60     /**
61      * The classes of this course.
62      */

63     private Collection JavaDoc<Class JavaDoc> classes;
64
65     /**
66      * Returns the classes of the course.
67      * @return the classes
68      */

69     @OneToMany(mappedBy = "course")
70     public Collection JavaDoc<Class JavaDoc> getClasses() {
71         return classes;
72     }
73
74     /**
75      * Sets the classes of the course.
76      * @param classes the classes.
77      */

78     public void setClasses(final Collection JavaDoc<Class JavaDoc> classes) {
79         this.classes = classes;
80     }
81
82     /**
83      * Returns the course identifier.
84      * @return the identifier.
85      */

86     @TableGenerator(name = "courseGen", table = "idTable", allocationSize = 2)
87     @Id
88     @GeneratedValue(strategy = GenerationType.TABLE, generator = "courseGen")
89     public Long JavaDoc getCourseId() {
90         return courseId;
91     }
92
93     /**
94      * Sets the course identifier.
95      * @param courseId the course identifier.
96      */

97     public void setCourseId(final Long JavaDoc courseId) {
98         this.courseId = courseId;
99     }
100
101     /**
102      * Returns the course credits.
103      * @return the credits.
104      */

105     public int getCredits() {
106         return credits;
107     }
108
109     /**
110      * Sets the course credits.
111      * @param credits the credits.
112      */

113     public void setCredits(final int credits) {
114         this.credits = credits;
115     }
116
117     /**
118      * Returns the course name.
119      * @return the name.
120      */

121     public String JavaDoc getName() {
122         return name;
123     }
124
125     /**
126      * Sets the course name.
127      * @param name the name.
128      */

129     public void setName(final String JavaDoc name) {
130         this.name = name;
131     }
132 }
133
Popular Tags