title: How to handle classes which don't differ from abstract superclass and require no table
body: <p>I have some classes which don't really differ from the abstract superclass, and so dont require their own table.  I am using the Spring Roo.</p>
  
  <p>I have a Task superclass mapped to a Task table, and am using the Inheritance.Joined inheritance model.</p>
  
  <pre><code>import java.math.BigDecimal;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Inheritance;
  import javax.persistence.InheritanceType;
  import javax.persistence.Table;
  
  privileged aspect Task_Roo_Jpa_Entity {
  
  declare @type: Task: @Entity;
  
  declare @type: Task: @Table(schema = "ADMIN_DIRECT", name = "TASK");
  
  declare @type: Task: @Inheritance(strategy = InheritanceType.JOINED);
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "ID")
  private BigDecimal Task.id;
  
  public BigDecimal Task.getId() {
      return this.id;
  }
  
  public void Task.setId(BigDecimal id) {
      this.id = id;
  }
  
  }
  </code></pre>
  
  <p>I have some subclasses which do not differ from the abstract super class, and so do not need a dedicated table in the database, while others do differ from the superclass and so have a dedicated table.</p>
  
  <p>I can get persistence to work by doing this in my subclasses which do not differ from the abstract class. I.e. create a subclass which Extends Task and annotate as below (note the table name TASK is actually the superclass table):</p>
  
  <pre><code>@Entity
  @Table(schema = "ADMIN_DIRECT", name = "TASK")
  
  public class ExpensesTask extends Task {
  
  
  }
  </code></pre>
  
  <p>This persists an entity in the TASK superclass table with a DTYPE column labelled "ExpensesTask" as the discriminator value.</p>
  
  <p>So it appears to work, although Eclipse is raising errors stating that</p>
  
  <pre><code>ExpensesTask" is mapped, but is not included in any persistence unit ... JPA Problem
  </code></pre>
  
  <p>If I let Roo take over as I do in my "proper" subclasses of task, then persistence seems to go through the motions and then fail silently (nothing persisted, no errors raised):</p>
  
  <p>i.e. this doesn't work</p>
  
  <pre><code>@RooJavaBean
  @RooToString
  @RooDbManaged(automaticallyDelete = true)
  @RooJpaActiveRecord(versionField = "", table = "TASK", schema = "ADMIN_DIRECT")
  public class ExpensesTask extends Task {
  
  }  
  
  
  
  
  import javax.persistence.Entity;
  import javax.persistence.Table;
  
  privileged aspect ExpensesTask_Roo_Jpa_Entity {
  
      declare @type: ExpensesTask: @Entity;
  
     declare @type: ExpensesTask: @Table(schema = "ADMIN_DIRECT", name = "TASK");    
  }
  </code></pre>
  
  <p>Would be interested to know the correct way to map this inheritance situation when there is no need to differentiate the subclass from abstract superclass.</p>
  
  <p>I could always create an "ExpensesTask" table with nothing but an "ID" field in it, so the Roo method works as for my other "subclass with table" classes, but as I have a working version (albeit with some Eclipse complaints) I am not sure if thats a bit of a "fudge".</p>