KickJava   Java API By Example, From Geeks To Geeks.

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


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: Student.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.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.JoinTable;
33 import javax.persistence.ManyToMany;
34
35 /**
36  * The student.
37  * @author Gisele Pinheiro Souza
38  * @author Eduardo Studzinski Estima de Castro
39  */

40 @Entity
41 public class Student {
42
43     /**
44      * Student identifier.
45      */

46     private Long JavaDoc id;
47
48     /**
49      * Serial version.
50      */

51     private static final long serialVersionUID = -7986846870958654109L;
52
53     /**
54      * Says if the student completed the studies in the university.
55      */

56     private boolean graduated;
57
58     /**
59      * The email.
60      */

61     private String JavaDoc email;
62
63     /**
64      * The current courses.
65      */

66     private Collection JavaDoc<Class JavaDoc> currentCours;
67
68     /**
69      * Returns the current courses.
70      * @return the courses.
71      */

72     @ManyToMany
73     @JoinTable(name = "CLASS_STUDENT", joinColumns = {@JoinColumn(name = "STUDENT_ID", referencedColumnName = "id")},
74             inverseJoinColumns = {
75             @JoinColumn(name = "CLASS_NAME", referencedColumnName = "className"),
76             @JoinColumn(name = "CLASS_YEAR", referencedColumnName = "classYear")})
77     public Collection JavaDoc<Class JavaDoc> getCurrentCours() {
78         return currentCours;
79     }
80
81     /**
82      * Sets the current courses.
83      * @param currentCours the courses.
84      */

85     public void setCurrentCours(final Collection JavaDoc<Class JavaDoc> currentCours) {
86         this.currentCours = currentCours;
87     }
88
89     /**
90      * Returns the student email.
91      * @return the email.
92      */

93     public String JavaDoc getEmail() {
94         return email;
95     }
96
97     /**
98      * Sets the student e-mail.
99      * @param email the student e-mail.
100      */

101     public void setEmail(final String JavaDoc email) {
102         this.email = email;
103     }
104
105     /**
106      * Returns the student status in the college.
107      * @return true if the student finished the program,false otherwise.
108      */

109     public boolean isGraduated() {
110         return graduated;
111     }
112
113     /**
114      * Sets if the student is graduated.
115      * @param graduated true if the student has finished the course, false
116      * otherwise.
117      */

118     public void setGraduated(final boolean graduated) {
119         this.graduated = graduated;
120     }
121
122     /**
123      * Gets the identifier.
124      * @return the identifier.
125      */

126     @Id
127     public Long JavaDoc getId() {
128         return id;
129     }
130
131     /**
132      * Sets the identifier.
133      * @param id the identifier.
134      */

135     public void setId(final Long JavaDoc id) {
136         this.id = id;
137     }
138
139 }
140
Popular Tags