1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10 @Entity
11 @Table(name="ORMINH_TOOTHPASTE")
12 public class ToothPaste extends BaseObject {
13 @Access(AccessType.FIELD)
14 private int size;
15
16 @Id @GeneratedValue
17 public long getId() { return super.getId(); }
18 protected void setId(long id) {
19 super.setId(id);
20 }
21
22 public int getSize() { return size; }
23 public void setSize(int size) {
24 this.size = size;
25 }
26
27 @Transient
28 public String getName() { return "" + size + "oz toothpaste"; }
29
30 public String toString() {
31 StringBuilder text = new StringBuilder(super.toString());
32 return text.toString();
33 }
34 }