01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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: Employee.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.examples.entitybean;
25:
26: import javax.persistence.Entity;
27: import javax.persistence.Id;
28: import javax.persistence.Table;
29:
30: /**
31: * Define an employee with an id and a name.
32: * @author Florent Benoit
33: */
34: @Entity
35: @Table(name="EMPLOYEES")
36: public class Employee implements java.io.Serializable {
37:
38: /**
39: * Id for serializable class.
40: */
41: private static final long serialVersionUID = -2366200007462547454L;
42:
43: /**
44: * Id of this employee.
45: */
46: private int id;
47:
48: /**
49: * Name of the employee.
50: */
51: private String name;
52:
53: /**
54: * Gets the Id of the employee.
55: * @return the id of the employee.
56: */
57: @Id
58: public int getId() {
59: return id;
60: }
61:
62: /**
63: * Sets id of the employee.
64: * @param id the id's employee
65: */
66: public void setId(final int id) {
67: this .id = id;
68: }
69:
70: /**
71: * Sets the name.
72: * @param name of employee.
73: */
74: public void setName(final String name) {
75: this .name = name;
76: }
77:
78: /**
79: * Gets the name of the employee.
80: * @return name of the employee.
81: */
82: public String getName() {
83: return name;
84: }
85:
86: /**
87: * Computes a string representation of this employee.
88: * @return string representation.
89: */
90: @Override
91: public String toString() {
92: StringBuilder sb = new StringBuilder();
93: sb.append("Employee[id=").append(getId()).append(", name=")
94: .append(getName()).append("]");
95: return sb.toString();
96: }
97:
98: }
|