是的,这在Hibernate中 受支持 。这里唯一的事情是我们必须使用 HQL :
- 16.2。from子句 (引用:)
可能会出现多个类,从而导致笛卡尔积或“交叉”联接。
from Formula, Parameterfrom Formula as form, Parameter as param
因此,在我们的情况下:
session .createQuery("SELECt t1.prop1, t1.prop2, t1.prop3 " + " t2.prop4, t2.prop5 " + " FROM Entity1 AS t1, Entity2 As t2 " + // if there is some relation - unmapped + " WHERe t1.someProperty = t2.someProperty " + " AND ... " ) .setMaxResults(10) // we can even page here .list()注意:我使用prop1,prop2和Entity1,Entity2 …来强制感觉这是HQL。 我们在谈论映射的实体,而不是表或列
我们将收到
object[]数组的集合…



