JPA/hibernate sorted collection @OrderBy vs @Sort
If you want to avoid non-standard annotations, you could make kittens use some sorted Collection implementation. This would ensure that kittens is always in sorted order. Something like this: @Entity public class Cat { @OneToMany(mappedBy = “cat”, cascade = CascadeType.ALL) @OrderBy(“name ASC”) private SortedSet<Kitten> kittens = new TreeSet<>(); } Note that this approach also requires … Read more