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: Building.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.entity.entitytest01;
025:
026: import java.util.Map;
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.MapKey;
033: import javax.persistence.OneToMany;
034:
035: /**
036: * Contains the building information.
037: * @author Gisele Pinheiro Souza
038: * @author Eduardo Studzinski Estima de Castro
039: *
040: */
041: @Entity
042: public class Building {
043:
044: /**
045: * The building identifier.
046: */
047: private Long id;
048:
049: /**
050: * The building name.
051: */
052: private String name;
053:
054: /**
055: * The room list in the building.
056: */
057: private Map<RoomPK, Room> rooms;
058:
059: /**
060: * Returns the building identifier.
061: * @return the identifier.
062: */
063: @Id
064: @GeneratedValue(strategy=GenerationType.AUTO)
065: public Long getId() {
066: return id;
067: }
068:
069: /**
070: * Sets the building identifier.
071: * @param id the identifier.
072: */
073: public void setId(final Long id) {
074: this .id = id;
075: }
076:
077: /**
078: * Returns the building name.
079: * @return the name.
080: */
081: public String getName() {
082: return name;
083: }
084:
085: /**
086: * Sets the building name.
087: * @param name the name.
088: */
089: public void setName(final String name) {
090: this .name = name;
091: }
092:
093: /**
094: * Returns the map with all rooms in the building.
095: * @return the rooms map.
096: */
097: @OneToMany(mappedBy="building")
098: @MapKey
099: public Map<RoomPK, Room> getRooms() {
100: return rooms;
101: }
102:
103: /**
104: * Sets the rooms map.
105: * @param rooms the rooms map.
106: */
107: public void setRooms(final Map<RoomPK, Room> rooms) {
108: this.rooms = rooms;
109: }
110:
111: }
|