title: Hibernate Mapping OneToMany + inheritance
body: <p>I'm asking to know the best way to map between my orders and requests.
  The <code>Order</code> class is:</p>
  
  <pre><code>@Entity
  @Table(name = "Orders")
  public class Order {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;
  
  }
  </code></pre>
  
  <p>I have a class that takes an <code>Order</code> attribute</p>
  
  <pre><code>@Entity
  @Table(name = "Requests")
  @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(name="request_type",discriminatorType=DiscriminatorType.STRING)
  public class Request {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;
  
  @ManyToOne(targetEntity = Order.class, fetch = FetchType.EAGER)
  @JoinColumn(name = "oldOrder_id", referencedColumnName = "id")
  private Order oldOrder;
  }
  </code></pre>
  
  <p>I have this subclass of <code>Request</code> which takes another <code>Order</code> attribute</p>
  
  <pre><code>@Entity
  @DiscriminatorValue("Edit")
  public class EditRequest extends Request {
  
  @ManyToOne(targetEntity = Order.class, fetch = FetchType.EAGER)
  @JoinColumn(name = "newOrder_id", referencedColumnName = "id")
  private Order newOrder;
  }
  </code></pre>
  
  <p>And I have another subclass (<code>CancelRequest</code>) of <code>Request</code> which doesnt take an <code>Order</code> attribute.</p>
  
  <p>It doesn't make sense if in the <code>Order</code> class I put :</p>
  
  <pre><code>@OneToMany(mappedBy="oldOrder")
  private Collection&lt;Request&gt; requests;
  
  @OneToMany(mappedBy="newOrder")
  private Collection&lt;EditRequest&gt; editRequests;
  </code></pre>
  
  <p>Because an order should have only one attribute of Type <code>Collection&lt;Request&gt;</code>.</p>
  
  <p>So What should I put in my <code>Order</code> class? </p>