I want to use JPA 2.0 criteria api to build the order by clause with a subselect. I know that you can do that in plain SQL but can it be mapped with criteria api? Can someone please give a code example?
Example:
Order(name, address) // table1
OrderPriority(address, priority) // table2 priority by address
select o from Order o order by (select p.priority from OrderPriority p where
p.address = o.address)