title: Hibernate annotations to exclude fields in base class
body: <p>I have a base class with four fields a,b,c &amp; d and two sub classes which extend it.</p>
  
  <p>I'm trying to ensure SubOne doesn't persist field d and SubTwo doesn't persist field c.</p>
  
  <p>The xml mapping below works perfectly. </p>
  
  <p><strong>Is this possible using annotations?</strong></p>
  
  <p>(Hibernate v3.2.4, JPA 1.0)</p>
  
  <pre><code>public class Base {
      private String a;
      private String b;
      private String c;
      private String d;   
  }
  
  public class SubOne extends Base {
      private int id;
  }
  
  public class SubTwo extends Base {
      private int id;
      private String e;
  }
  </code></pre>
  
  <p>Mapping:</p>
  
  <pre><code>&lt;class name="SubOne" table="SubOne"&gt;
      &lt;id name="id" column="Id"&gt;
          &lt;generator class="identity"/&gt;
      &lt;/id&gt;
      &lt;property name="a" column="a" /&gt;
      &lt;property name="b" column="b" /&gt;
      &lt;property name="c" column="c" /&gt;
  &lt;/class&gt;
  
  &lt;class name="SubTwo" table="SubTwo"&gt;
      &lt;id name="id" column="Id"&gt;
          &lt;generator class="identity"/&gt;
      &lt;/id&gt;
      &lt;property name="a" column="a" /&gt;
      &lt;property name="b" column="b" /&gt;
      &lt;property name="d" column="d" /&gt;
      &lt;property name="e" column="e" /&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>SubOne Class:</p>
  
  <pre><code>@Entity
  @Table(name="SubOne")
  public class SubOne extends Base implements Serializable {       
  
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  
  @Override
  public String getA() {
      return super.getA();
  }
  
  @Override
  public String getB() {
      return super.getB();
  }
  
  @Override
  public String getC() {
      return super.getC();
  }
  
  }
  </code></pre>