title: How to inherit a model from superclass in playframework
body: <p>I'm trying to understand how does the inheritance work in play! But unsuccessfully yet.</p>
  
  <p>So, I have such superclass:</p>
  
  <pre><code>@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)  
  abstract class SuperClass extends Model {  
      @Id  
      @GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQ_TABLE")   
      @TableGenerator(name = "SEQ_TABLE")  
      Long id;  
  
      int testVal;
  }
  </code></pre>
  
  <p>And 2 inherited classes:</p>
  
  <pre><code>@Entity
  public class Sub extends SuperClass {        
      String name;
  
      @Override
      public String toString() {
              return name;
      }
  }
  
  @Entity
  public class Sub1 extends SuperClass {        
      String name;
  
      @Override
      public String toString() {
              return name;
      }
  }
  </code></pre>
  
  <p>Also I have 2 controllers for inherited classes: </p>
  
  <pre><code>public class Subs and Sub1s extends CRUD {
  
  }
  </code></pre>
  
  <p>After application was started, I recieve 2 tables in MySQL db for my models (Sub and Sub1) with such structure: <strong>id</strong> bigint(20), <strong>name</strong> varchar(255). Without <strong>testVal</strong> which is in superclass.</p>
  
  <p>And when I try to create new object of <em>Sub</em> class in CRUD interface I recieve such error:
  <em>Execution error occured in template {module:crud}/app/views/tags/crud/form.html. Exception raised was <strong>MissingPropertyException : No such property: testVal for class: models.Sub.</strong></em> </p>
  
  <p>In {module:crud}/app/views/tags/crud/form.html (around line 64)
  <strong>#{crud.numberField name:field.name, value:(currentObject ? currentObject[field.name] : null) /}</strong></p>
  
  <ol>
  <li>What should I do to generate MySQL tables for inherited models properly and fix the error?</li>
  <li>Is it possible to have a single superController for several inherited classes?</li>
  </ol>