1 package ejava.examples.webtier.bo;
2
3 import java.io.Serializable;
4
5 import javax.persistence.*;
6
7 @MappedSuperclass
8 public class Person implements Serializable {
9 private static final long serialVersionUID = 1L;
10 private long id;
11 private String firstName;
12 private String lastName;
13
14 public Person() {}
15 public Person(long id) { setId(id); }
16 public Person(long id, String firstName, String lastName) {
17 setId(id);
18 setFirstName(firstName);
19 setLastName(lastName);
20 }
21 @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
22 public long getId() {
23 return id;
24 }
25 private void setId(long id) {
26 this.id = id;
27 }
28
29 public String getFirstName() {
30 return firstName;
31 }
32 public void setFirstName(String firstName) {
33 this.firstName = firstName;
34 }
35 public String getLastName() {
36 return lastName;
37 }
38 public void setLastName(String lastName) {
39 this.lastName = lastName;
40 }
41 public String toString() {
42 StringBuilder text = new StringBuilder();
43 text.append("id=" + id);
44 text.append(", firstName=" + firstName);
45 text.append(", lastName=" + lastName);
46 return text.toString();
47 }
48 }