I have a class that says: "ClassA", which has a collection of "ClassB"
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "COLUMN_NAME") private List<ClassB> lotsOfClasses;
"ClassB" has a mapped class "ClassC" using plain old display annotations:
public class ClassB { ... @ManyToOne @JoinColumn(name="AD_POINT_ID") private ClassC classC; ... }
How to add the @OrderBy annotation to the ClassA collection to ClassB, so that the collection is ordered by the "name" property of the ClassC class
Same:
@OrderBy(clause="classC.name asc")
All I get are Oracle exceptions saying that classC is unknown.
Any help here would be awesome as it really bothered me at the moment.
PS It should also be mentioned that using the OrderBy annotation in the collection: @OrderBy (clause = "classC asc") (that is, without .name on classC) I get a valid SQL statement that uses the column ID (primary key) of class C for ordering.
Cheers, Mark
oracle annotations hibernate
Mark
source share