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_RECTANGLE")
15 public class Rectangle extends Shape {
16 private int height;
17 private int width;
18
19 @Transient
20 public String getName() {
21 return "rectangle:" + getId();
22 }
23
24 public int getHeight() {
25 return height;
26 }
27 public void setHeight(int height) {
28 this.height = height;
29 }
30
31 public int getWidth() {
32 return width;
33 }
34 public void setWidth(int width) {
35 this.width = width;
36 }
37
38 public String toString() {
39 StringBuilder text = new StringBuilder(super.toString());
40 text.append(", height=" + height);
41 text.append(", width=" + width);
42 return text.toString();
43 }
44 }