looking for some solutions? You are welcome.

SOLVED: One to many order by with case hibernate spring

ivaylo:

I have a query that orders the entities by 2 dates:

@Query(value = "from Order order by CASE WHEN created > updated THEN created ELSE updated END desc")

Can I do the same with @OneToMany in the @OrderBy anotation?

@OneToMany(cascade = CascadeType.ALL ,mappedBy = "order", fetch = FetchType.EAGER)
@OrderBy(...)
private List<Dish> dishes = new ArrayList<>();



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent