【发布时间】:2016-06-25 14:12:00
【问题描述】:
我知道如何查询具有特定类型订单的客户(在使用 leftjoinfetch 加入订单后):
select c from Customer c where c.orders.type = 'CANCELLED'
我也知道如何查询没有订单的客户:
select c from Customer c where c.orders is empty
如何在一个查询中选择所有具有某种订单类型或根本没有订单的客户?
谢谢。
【问题讨论】:
-
我看不到您在所示语句的任何地方使用的任何左连接提取。此外,
c.orders.type将在某些 JPA 提供程序(如 Hibernate)上生成笛卡尔积(交叉连接)。
标签: java jpa select left-join jpql