KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > entitytest00 > Person


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

25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest00;
26
27 import java.io.Serializable JavaDoc;
28 import java.util.Date JavaDoc;
29
30 import javax.persistence.DiscriminatorColumn;
31 import javax.persistence.DiscriminatorValue;
32 import javax.persistence.Entity;
33 import javax.persistence.GeneratedValue;
34 import javax.persistence.GenerationType;
35 import javax.persistence.Id;
36 import javax.persistence.Inheritance;
37 import javax.persistence.InheritanceType;
38 import javax.persistence.Lob;
39 import javax.persistence.Table;
40 import javax.persistence.TableGenerator;
41 import javax.persistence.Temporal;
42 import javax.persistence.TemporalType;
43
44 /**
45  * Represents the common data among the diffent possitions.
46  * @author Gisele Pinheiro Souza
47  * @author Eduardo Studzinski Estima de Castro
48  *
49  */

50 @Entity
51 @Table(name = "PERSON")
52 @DiscriminatorColumn(name = "PersonType")
53 @DiscriminatorValue("Person")
54 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
55 @TableGenerator(name = "PERSON_SEQ", allocationSize = 2)
56 public class Person implements Serializable JavaDoc {
57
58     /**
59      * Serial version.
60      */

61     private static final long serialVersionUID = -2588575691131751927L;
62
63     /**
64      * The person identifier.
65      */

66     private Long JavaDoc id;
67
68     /**
69      * The family name.
70      */

71     private String JavaDoc familyName;
72
73     /**
74      * The first name.
75      */

76     private String JavaDoc firstName;
77
78     /**
79      * The date fo admission.
80      */

81     private Date JavaDoc startDate;
82
83     /**
84      * The date of depart.
85      */

86      private Date JavaDoc endDate;
87
88     /**
89      * The picture.
90      */

91     private byte[] picture;
92
93     /**
94      * Returns the depart date.
95      * @return the date.
96      */

97     @Temporal(TemporalType.DATE)
98     public Date JavaDoc getEndDate() {
99         return endDate;
100     }
101
102     /**
103      * Sets the depart date.
104      * @param endDate the date.
105      */

106     public void setEndDate(final Date JavaDoc endDate) {
107         this.endDate = endDate;
108     }
109
110     /**
111      * Returns the family name.
112      * @return the name.
113      */

114     public String JavaDoc getFamilyName() {
115         return familyName;
116     }
117
118     /**
119      * Sets the family name.
120      * @param familyName the name.
121      */

122     public void setFamilyName(final String JavaDoc familyName) {
123         this.familyName = familyName;
124     }
125
126     /**
127      * Returns the first name.
128      * @return the name.
129      */

130     public String JavaDoc getFirstName() {
131         return firstName;
132     }
133
134     /**
135      * Sets the first name.
136      * @param firstName the name.
137      */

138     public void setFirstName(final String JavaDoc firstName) {
139         this.firstName = firstName;
140     }
141
142     /**
143      * Returns the person identifier.
144      * @return the identifier.
145      */

146
147     @Id
148     @GeneratedValue(strategy = GenerationType.TABLE, generator = "PERSON_SEQ")
149     public Long JavaDoc getId() {
150         return id;
151     }
152
153     /**
154      * Returns the admission date.
155      * @return the date.
156      */

157     @Temporal(TemporalType.DATE)
158     public Date JavaDoc getStartDate() {
159         return startDate;
160     }
161
162     /**
163      * Sets the admission date.
164      * @param startDate the date.
165      */

166     public void setStartDate(final Date JavaDoc startDate) {
167         this.startDate = startDate;
168     }
169
170     /**
171      * Returns the person picture.
172      * @return the picture.
173      */

174     @Lob
175     public byte[] getPicture() {
176         return picture;
177     }
178
179     /**
180      * Sets the person picture.
181      * @param picture the picture.
182      */

183     public void setPicture(final byte[] picture) {
184         this.picture = picture;
185     }
186
187     /**
188      * Sets the identifier.
189      * @param id the identifier.
190      */

191     public void setId(final Long JavaDoc id) {
192         this.id = id;
193     }
194
195 }
196
Popular Tags