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   */
13  @Entity @Table(name="ORMINH_CIRCLE")
14  public class Circle extends Shape {
15      private int radius;
16  
17      @Transient
18      public String getName() {
19          return "circle:" + getId();
20      }
21  
22      public int getRadius() {
23          return radius;
24      }
25      public void setRadius(int radius) {
26          this.radius = radius;
27      }
28  
29      public String toString() {
30          StringBuilder text = new StringBuilder(super.toString());
31          text.append(", radius=" + radius);
32          return text.toString();
33      }
34  }