gpt4 book ai didi

hibernate - 在 HQL 中加入但不关联

转载 作者:行者123 更新时间:2023-12-03 06:21:35 27 4
gpt4 key购买 nike

假设我有两个表(A,B),例如:

A {id, a, c}
B {id, b, c}

我也有他们的实体。我想编写一个 HQL,以便结果集类似于(其中 A.c = B.c):

(a1, b1, c1)
(a2, b2, c2)
(a3, b3, c3)
...

由于 hibernate 不支持 on 子句,我陷入困境,我不知道如何编写查询。

最佳答案

您必须使用交叉连接符号:

from A as table_a , B as table_b
where table_a.c = table_b.c

当然,无法以这种方式实现外连接,因此如果是您的情况,您可能会遇到一些麻烦。

对于具有标准的类似情况,请参阅:hibernate-criteria-joining-table-without-a-mapped-association

关于hibernate - 在 HQL 中加入但不关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/974085/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com