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: ClassRoom.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.OneToMany;
031: import javax.persistence.OrderBy;
032:
033: /**
034: * The room where there are the classes.
035: * @author Gisele Pinheiro Souza
036: * @author Eduardo Studzinski Estima de Castro
037: *
038: */
039: @Entity
040: public class ClassRoom {
041:
042: /**
043: * Room identifier.
044: */
045: private Long id;
046: /**
047: * The number of places in the class.
048: */
049: private int capacity;
050:
051: /**
052: * The classes in this room.
053: */
054: private Collection<Class> classes;
055:
056: /**
057: * The classes in this room.
058: * @return the classes.
059: */
060: @OneToMany(mappedBy="classRoom")
061: @OrderBy("className ASC")
062: public Collection<Class> getClasses() {
063: return classes;
064: }
065:
066: /**
067: * Set The classes in this room.
068: * @param classes the classes.
069: */
070: public void setClasses(final Collection<Class> classes) {
071: this .classes = classes;
072: }
073:
074: /**
075: * Returns the number of places in this room.
076: * @return the capacity.
077: */
078: public int getCapacity() {
079: return capacity;
080: }
081:
082: /**
083: * Sets the number of places in this room.
084: * @param capacity the capacity.
085: */
086: public void setCapacity(final int capacity) {
087: this .capacity = capacity;
088: }
089:
090: /**
091: * Gets the class identifier.
092: * @return the identifier.
093: */
094: @Id
095: public Long getId() {
096: return id;
097: }
098:
099: /**
100: * Sets the class identifier.
101: * @param id the identifier.
102: */
103: public void setId(final Long id) {
104: this.id = id;
105: }
106:
107: }
|