KickJava   Java API By Example, From Geeks To Geeks.

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


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: ClassRoom.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.OneToMany;
32 import javax.persistence.OrderBy;
33
34 /**
35  * The room where there are the classes.
36  * @author Gisele Pinheiro Souza
37  * @author Eduardo Studzinski Estima de Castro
38  *
39  */

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

46     private Long JavaDoc id;
47     /**
48      * The number of places in the class.
49      */

50     private int capacity;
51
52     /**
53      * The classes in this room.
54      */

55     private Collection JavaDoc<Class JavaDoc> classes;
56
57     /**
58      * The classes in this room.
59      * @return the classes.
60      */

61     @OneToMany(mappedBy="classRoom")
62     @OrderBy("className ASC")
63     public Collection JavaDoc<Class JavaDoc> getClasses() {
64         return classes;
65     }
66
67     /**
68      * Set The classes in this room.
69      * @param classes the classes.
70      */

71     public void setClasses(final Collection JavaDoc<Class JavaDoc> classes) {
72         this.classes = classes;
73     }
74
75     /**
76      * Returns the number of places in this room.
77      * @return the capacity.
78      */

79     public int getCapacity() {
80         return capacity;
81     }
82
83     /**
84      * Sets the number of places in this room.
85      * @param capacity the capacity.
86      */

87     public void setCapacity(final int capacity) {
88         this.capacity = capacity;
89     }
90
91     /**
92      * Gets the class identifier.
93      * @return the identifier.
94      */

95     @Id
96     public Long JavaDoc getId() {
97         return id;
98     }
99
100     /**
101      * Sets the class identifier.
102      * @param id the identifier.
103      */

104     public void setId(final Long JavaDoc id) {
105         this.id = id;
106     }
107
108
109 }
110
Popular Tags