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: Course.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.GeneratedValue;
030: import javax.persistence.GenerationType;
031: import javax.persistence.Id;
032: import javax.persistence.OneToMany;
033: import javax.persistence.TableGenerator;
034:
035: /**
036: * The course that ccan have many classes.
037: * @author Gisele Pinheiro Souza
038: * @author Eduardo Studzinski Estima de Castro
039: *
040: */
041: @Entity
042: public class Course {
043:
044: /**
045: * The identifier.
046: */
047: private Long courseId;
048:
049: /**
050: * The course name.
051: */
052: private String name;
053:
054: /**
055: * The number of credits.
056: */
057: private int credits;
058:
059: /**
060: * The classes of this course.
061: */
062: private Collection<Class> classes;
063:
064: /**
065: * Returns the classes of the course.
066: * @return the classes
067: */
068: @OneToMany(mappedBy="course")
069: public Collection<Class> getClasses() {
070: return classes;
071: }
072:
073: /**
074: * Sets the classes of the course.
075: * @param classes the classes.
076: */
077: public void setClasses(final Collection<Class> classes) {
078: this .classes = classes;
079: }
080:
081: /**
082: * Returns the course identifier.
083: * @return the identifier.
084: */
085: @TableGenerator(name="courseGen",table="idTable",allocationSize=2)
086: @Id
087: @GeneratedValue(strategy=GenerationType.TABLE,generator="courseGen")
088: public Long getCourseId() {
089: return courseId;
090: }
091:
092: /**
093: * Sets the course identifier.
094: * @param courseId the course identifier.
095: */
096: public void setCourseId(final Long courseId) {
097: this .courseId = courseId;
098: }
099:
100: /**
101: * Returns the course credits.
102: * @return the credits.
103: */
104: public int getCredits() {
105: return credits;
106: }
107:
108: /**
109: * Sets the course credits.
110: * @param credits the credits.
111: */
112: public void setCredits(final int credits) {
113: this .credits = credits;
114: }
115:
116: /**
117: * Returns the course name.
118: * @return the name.
119: */
120: public String getName() {
121: return name;
122: }
123:
124: /**
125: * Sets the course name.
126: * @param name the name.
127: */
128: public void setName(final String name) {
129: this.name = name;
130: }
131: }
|