looking for some solutions? You are welcome.

SOLVED: One to many order by with case hibernate spring


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)
private List<Dish> dishes = new ArrayList<>();

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

No comments: