1

使用 HQL,您如何加入非 PK/FK 的列(或对象属性)?

我正在阅读文档,它似乎隐含地要加入 PK 列,对吗?

https://www.hibernate.org/hib_docs/nhibernate/html/queryhql.html

4

2 回答 2

2

HQL 在外键上“隐式”连接。如果您没有(映射)关系,只需制作笛卡尔积并加入 where 子句。

select order.id
from Order as o, Product as p
where o.productKey = p.Key
于 2009-05-19T14:26:55.457 回答
1

从 Order as o 中选择 order.id,Product as p 其中 o.productKey = p.Key

那将是一个内连接,有没有办法可以使用隐式连接来做一个左外连接。

于 2010-03-06T13:19:30.643 回答