My sample code is:
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. ... }
Using this code, EclipseLink will try to create the "ORDER" column 2 times, throwing an exception and not creating table B.
Thank.
Please register an error for this problem in EclipseLink.
You do not need a column for the query, you can use the JPQL INDEX index (bList) to query the order column.
EclipseLink DescriptorCustomizer QueryKey , .
@OrderBy @OrderColumn. http://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html