I have a class say: \"ClassA\" which has a collection of \"ClassB\"
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = \"COLUMN
use @Sort
with custom comparator instead
It's unfortunately impossible to do what you want. I've answered a similar question here.
@OrderBy
only supports direct properties of the collection elements.
This is possible if you use JPA. See this article.
Then you just add @OrderBy("name")
to the collection property
I only know NHibernate (.NET version), but I guess it should work similar:
@OrderBy(clause = "name asc")
Or you can try this:
@OrderBy("name")