title: @OrderColumn, @OneToMany & null index column for collection
body: <p>I am trying to create parent child tables where the order is preserved.  The example 7.8 from Hibernate documentation shows how to do this:</p>
  
  <pre><code>@Entity
  public class Customer {
     @Id @GeneratedValue public Integer getId() { return id; }
     public void setId(Integer id) { this.id = id; }
     private Integer id;
  
     @OneToMany(mappedBy="customer")
     @OrderColumn(name="orders_index")
     public List&lt;Order&gt; getOrders() { return orders; }
     public void setOrders(List&lt;Order&gt; orders) { this.orders = orders; }
     private List&lt;Order&gt; orders;
  }
  
  @Entity
  public class Order {
     @Id @GeneratedValue public Integer getId() { return id; }
     public void setId(Integer id) { this.id = id; }
     private Integer id;
  
     public String getNumber() { return number; }
     public void setNumber(String number) { this.number = number; }
     private String number;
  
     @ManyToOne
     public Customer getCustomer() { return customer; }
     public void setCustomer(Customer customer) { this.customer = customer; }
     private Customer number;
  }
  </code></pre>
  
  <p>from <a href="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-indexed">http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-indexed</a></p>
  
  <p>When I try this I get an error:
  null index column for collections</p>
  
  <p>There is Hibernate issue that describes the problem and gives an invalid example, but it specifically says that the example I gave above from the docs IS valid.</p>
  
  <pre><code>@Entity
  public class Parent {
      @OneToMany(mappedBy="parent")
      @OrderColumn(name="order")
      private List&lt;Child&gt; children;
  }
  
  @Entity
  public class Child {
      @ManyToOne
      private Parent parent;
  }
  </code></pre>
  
  <p>from: <a href="https://hibernate.onjira.com/browse/HHH-5390">https://hibernate.onjira.com/browse/HHH-5390</a></p>
  
  <p>Maybe I'm being dense, but I don't see the difference between these two examples. One is:</p>
  
  <pre><code>@OneToMany(mappedBy="customer")
  @OrderColumn(name="orders_index")
  </code></pre>
  
  <p>The other is:</p>
  
  <pre><code>@OneToMany(mappedBy="parent")
  @OrderColumn(name="order")
  </code></pre>
  
  <p>And of course, I haven't figured out how to the get OrderColumn to work.  Does anyone have any insight into why one of these examples is valid and the other is not?</p>