001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: Student.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.entity.entitytest03;
025:
026: import java.util.Collection;
027:
028: import javax.persistence.Entity;
029: import javax.persistence.Id;
030: import javax.persistence.JoinColumn;
031: import javax.persistence.JoinTable;
032: import javax.persistence.ManyToMany;
033:
034: /**
035: * The student.
036: * @author Gisele Pinheiro Souza
037: * @author Eduardo Studzinski Estima de Castro
038: */
039: @Entity
040: public class Student {
041:
042: /**
043: * Student identifier.
044: */
045: private Long id;
046:
047: /**
048: * Serial version.
049: */
050: private static final long serialVersionUID = -7986846870958654109L;
051:
052: /**
053: * Says if the student completed the studies in the university.
054: */
055: private boolean graduated;
056:
057: /**
058: * The email.
059: */
060: private String email;
061:
062: /**
063: * The current courses.
064: */
065: private Collection<Class> currentCours;
066:
067: /**
068: * Returns the current courses.
069: * @return the courses.
070: */
071: @ManyToMany
072: @JoinTable(name="CLASS_STUDENT",joinColumns={@JoinColumn(name="STUDENT_ID",referencedColumnName="id")},inverseJoinColumns={@JoinColumn(name="CLASS_NAME",referencedColumnName="className"),@JoinColumn(name="CLASS_YEAR",referencedColumnName="classYear")})
073: public Collection<Class> getCurrentCours() {
074: return currentCours;
075: }
076:
077: /**
078: * Sets the current courses.
079: * @param currentCours the courses.
080: */
081: public void setCurrentCours(final Collection<Class> currentCours) {
082: this .currentCours = currentCours;
083: }
084:
085: /**
086: * Returns the student email.
087: * @return the email.
088: */
089: public String getEmail() {
090: return email;
091: }
092:
093: /**
094: * Sets the student e-mail.
095: * @param email the student e-mail.
096: */
097: public void setEmail(final String email) {
098: this .email = email;
099: }
100:
101: /**
102: * Returns the student status in the college.
103: * @return true if the student finished the program,false otherwise.
104: */
105: public boolean isGraduated() {
106: return graduated;
107: }
108:
109: /**
110: * Sets if the student is graduated.
111: * @param graduated true if the student has finished the course, false
112: * otherwise.
113: */
114: public void setGraduated(final boolean graduated) {
115: this .graduated = graduated;
116: }
117:
118: /**
119: * Gets the identifier.
120: * @return the identifier.
121: */
122: @Id
123: public Long getId() {
124: return id;
125: }
126:
127: /**
128: * Sets the identifier.
129: * @param id the identifier.
130: */
131: public void setId(final Long id) {
132: this.id = id;
133: }
134:
135: }
|