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