Reputation: 680
My sample code:
public class A { @OneToMany @OrderColumn(name = "ORDER") private List<B> bList; ... } public class B { @Column(name = "ORDER") private Integer order; // I need this field because I want // to use the ordering field in my query. ... }
With this code EclipseLink try to create the "ORDER" column 2 times throwing an exception and don't create the B table.
Thanks.
Upvotes: 7
Views: 1094
Reputation: 12222
Use @OrderBy instead of @OrderColumn. Look at reference http://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html
Upvotes: 1
Reputation: 18389
Please log a bug for this issue on EclipseLink.
You should not need the column just for querying, you can use the JPQL INDEX(bList) to query the order column.
In EclipseLink you can also use a DescriptorCustomizer to define a QueryKey for any column to allow querying on it.
Upvotes: 2