I've been following the example in "2.4.6.2.3. Bidirectional association with indexed collections" but I still don't get any population of the index column, any suggestions would be appreciated:
Code:
@Entity
public class Parent {
@Id
@GeneratedValue
private int parentId;
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@org.hibernate.annotations.IndexColumn(name = "childOrder")
private List<Child> children = new ArrayList<Child>();
...
}
Code:
@Entity
public class Child {
@Id
@GeneratedValue
private int id;
private int childOrder;
@ManyToOne
@JoinColumn(name = "parentId", nullable = false)
private Parent parent;
...
}
I can't see where I'm going wrong. The childOrder exists so mappedBy can be used on the parent side, right?