1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9 @MappedSuperclass
10 public abstract class BaseObject {
11 private long id;
12 @Access(AccessType.FIELD)
13 private long version;
14
15 @Transient
16 public long getId() { return id; }
17 protected void setId(long id) {
18 this.id = id;
19 }
20
21 public long getVersion() { return version; }
22 public void setVersion(long version) {
23 this.version = version;
24 }
25
26 @Transient
27 public abstract String getName();
28
29 public String toString() {
30 StringBuilder text = new StringBuilder(super.toString());
31 text.append(", id=" + id);
32 text.append(", name=" + getName());
33 return text.toString();
34 }
35 }