KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > entitytest01 > Building


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: Building.java 975 2006-07-28 11:14:14Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest01;
26
27 import java.util.Map JavaDoc;
28
29 import javax.persistence.Entity;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.MapKey;
34 import javax.persistence.OneToMany;
35
36 /**
37  * Contains the building information.
38  * @author Gisele Pinheiro Souza
39  * @author Eduardo Studzinski Estima de Castro
40  *
41  */

42 @Entity
43 public class Building {
44
45     /**
46      * The building identifier.
47      */

48     private Long JavaDoc id;
49
50     /**
51      * The building name.
52      */

53     private String JavaDoc name;
54
55     /**
56      * The room list in the building.
57      */

58     private Map JavaDoc< RoomPK, Room> rooms;
59
60     /**
61      * Returns the building identifier.
62      * @return the identifier.
63      */

64     @Id
65     @GeneratedValue(strategy = GenerationType.AUTO)
66     public Long JavaDoc getId() {
67         return id;
68     }
69
70
71     /**
72      * Sets the building identifier.
73      * @param id the identifier.
74      */

75     public void setId(final Long JavaDoc id) {
76         this.id = id;
77     }
78
79
80     /**
81      * Returns the building name.
82      * @return the name.
83      */

84     public String JavaDoc getName() {
85         return name;
86     }
87
88     /**
89      * Sets the building name.
90      * @param name the name.
91      */

92     public void setName(final String JavaDoc name) {
93         this.name = name;
94     }
95
96     /**
97      * Returns the map with all rooms in the building.
98      * @return the rooms map.
99      */

100     @OneToMany(mappedBy="building")
101     @MapKey
102     public Map JavaDoc<RoomPK, Room> getRooms() {
103         return rooms;
104     }
105
106
107     /**
108      * Sets the rooms map.
109      * @param rooms the rooms map.
110      */

111     public void setRooms(final Map JavaDoc<RoomPK, Room> rooms) {
112         this.rooms = rooms;
113     }
114
115
116 }
117
Popular Tags