View Javadoc
1   package ejava.examples.orm.inheritance.annotated;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This class provides an attempt to re-define the JOIN InheritanceType of the
7    * parent class to a TABLE_PER_CLASS type. If you look closly at the database,
8    * this instruction is ignored and the Cube sub-table is JOINED with the parent
9    * class tables to form the object instead.
10   *
11   */
12  @Entity
13  @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) //ignored!!!
14  @Table(name="ORMINH_CUBE")
15  public class Cube extends Rectangle {
16      private int depth;
17  
18      public int getDepth() {
19          return depth;
20      }
21      public void setDepth(int depth) {
22          this.depth = depth;
23      }
24      
25      public String toString() {
26          StringBuilder text = new StringBuilder(super.toString());
27          text.append(", depth=" + depth);
28          return text.toString();
29      }
30      
31  }