我有2个实体:汽车和轮子(oneToMany),我想要检索我的汽车,所有车轮和(这是棘手的部分)由wheels.location订购.下面的代码抛出一个异常,消息"非法尝试取消引用收集".
Select c from Car LEFT JOIN FETCH c.wheels order by c.wheels.location
知道如何做到这一点,如果在HQL中可以做到这一点?
SELECT DISTINCT c FROM Car LEFT JOIN FETCH c.wheels AS wheels ORDER BY wheels.location