1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10
11 @Entity @Table(name="ORMINH_PERSON")
12 @Inheritance(strategy=InheritanceType.JOINED)
13 public class Person {
14 @Id @GeneratedValue
15 private long id;
16 private String firstName;
17 private String lastName;
18
19 public Person() {}
20 public Person(long id) { this.id=id; }
21 public long getId() { return id; }
22
23 public String getFirstName() { return firstName; }
24 public void setFirstName(String firstName) {
25 this.firstName = firstName;
26 }
27
28 public String getLastName() { return lastName; }
29 public void setLastName(String lastName) {
30 this.lastName = lastName;
31 }
32
33 public String toString() {
34 StringBuilder text = new StringBuilder(super.toString());
35 text.append(", id=" + id);
36 text.append(", firstName=" + firstName);
37 text.append(", lastName=" + lastName);
38 return text.toString();
39 }
40 }