I am using a class to hold a list of persisted objects, and the order of those objects really matter to me.
The class looks like this:
public class Class implements Serializable {
private static final long serialVersionUID = -8772078256979276783L;
@ManyToMany(cascade={CascadeType.MERGE,CascadeType.PERSIST,CascadeType.DETACH,CascadeType.REFRESH})
@JoinTable(name = "join_table",
joinColumns = {
@JoinColumn(name="joinColumn")
},
inverseJoinColumns = {
@JoinColumn(name="inverseJoinColumn")
}
)
private List<AbstractVariant> variablesList;
}
Is there a way to add to that JoinTable an index to specify the position on the list, therefore,keeping the order safe?
That's the goal of the @OrderColumn
annotation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With