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   * @author jcstaff
12   */
13  @Entity
14  @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) //ignored!!!
15  @Table(name="ORMINH_CUBE")
16  public class Cube extends Rectangle {
17      private int depth;
18  
19      public int getDepth() {
20          return depth;
21      }
22      public void setDepth(int depth) {
23          this.depth = depth;
24      }
25      
26      public String toString() {
27          StringBuilder text = new StringBuilder(super.toString());
28          text.append(", depth=" + depth);
29          return text.toString();
30      }
31      
32  }