HQL Hibernate查询中的java左连接
我有2个Entite,每个都存储在mysql表中。 1.productA:{productId(pk),desc,date} 2.productB:{productId(pk),数量,类型,日期}
我要运行此SQL查询:
select a.*
from productA a left join productB b using(productId)
where b.productId is null
(从a退回b中不存在的所有产品)
是否可以在Hibernate中编写此查询
谢谢
# 1 楼答案
当然可以。从JPA specification 2.1 (4.4.5.2 Left Outer Joins):