I had the same problem. With me it was the combination of the @ManyToMany annotation with a java.util.List. It seems that Hibernate has a problem with recreating a Collection when the order might matter. I think that Hibernate does not check whether you actually put a Set or List into the Collection and therefore Hibernate checks the order. So there are two possible ways, I know of, to solve this. Either you put an extra annotation @IndexColumn(name = "NAME_OF_THE_INDEX_COLUMN") to your Collection
public class Member extends User implements Comparable<Member> {
@ManyToMany
@JoinTable(name = "Friends")
@Filters({ @Filter(name = "deleted") })
@IndexColumn(name = "NAME_OF_THE_INDEX_COLUMN")
private Collection<Member> friends = new HashSet<Member>();
}
or if the order does not matter to you, change the type to the interface Set.
public class Member extends User implements Comparable<Member> {
@ManyToMany
@JoinTable(name = "Friends")
@Filters({ @Filter(name = "deleted") })
private Set<Member> friends = new HashSet<Member>();
}
Hope this will help solve your problem.