【发布时间】:2021-03-22 10:54:33
【问题描述】:
我正在尝试通过使用 blaze 位持久性来连接子查询,我有一个像下面这样的标准构建器,
cbf.create(em, b.class, "foo")
.innerJoinOnSubquery(aCTE.class, "maxEnt")
.from(a.class, "subFoo")
.bind("account_id").select("subFoo.accountId","account_id")
.bind("id").select("subFoo.id","id")
.where("subFoo.accountId").eq(100L)
.end()
.on("maxEnt.account_id").eqExpression("foo.accountId")
.end()
.where("foo.accountId").eq(100L);
当我执行它时,我得到如下 sql 查询
SELECT s0_.id FROM b s0_
INNER JOIN (SELECT t0_.account_id AS col_0_0_,
t0_.id AS col_1_0_
FROM a t0_
WHERE t0_.account_id = 100 ) t1_
ON ( ( NULL IS NULL )
AND s0_.account_id = t1_.account_id) WHERE s0_.account_id = 100
问题出现在 on 子句中,当我尝试比较 on 子句中的两个表 account_id 时,由于别名是为account_id 默认在子查询中。请让我知道如何解决它。我使用的是 hibernate5.4 JPA 供应商。
问题:DB::Exception: There's no column 't1_.account_id' in table 't1_': While processing t1_.account_id.
【问题讨论】:
标签: java jpa blaze-persistence