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