1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10
11
12
13
14 @Entity @Table(name="ORMINH_SHAPE")
15 @Inheritance(strategy=InheritanceType.JOINED)
16 public abstract class Shape extends BaseObject {
17 private int posx;
18 private int posy;
19
20 @Id @GeneratedValue
21 public long getId() { return super.getId(); }
22 protected void setId(long id) { super.setId(id); }
23
24 public int getPosx() {
25 return posx;
26 }
27 public void setPosx(int posx) {
28 this.posx = posx;
29 }
30 public int getPosy() {
31 return posy;
32 }
33 public void setPosy(int posy) {
34 this.posy = posy;
35 }
36
37 public String toString() {
38 StringBuilder text = new StringBuilder(super.toString());
39 text.append(", posx=" + posx);
40 text.append(", posy=" + posy);
41 return text.toString();
42 }
43 }