View Javadoc
1   package ejava.examples.orm.inheritance.annotated;
2   
3   import javax.persistence.*;
4   
5   /**
6   * This class provides an example of an entity sub-class that is part of a 
7   * mixed strategy of inheritance. The root base class is a non-entity and 
8   * the immediate base class uses a join table strategy. That means that a table
9   * will be created to hold the unque properties of this class and joined with
10  * the parent table.
11   *
12   * @author jcstaff
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  }