Java JPA子查询不工作
我正在尝试执行JPA查询Java JPA子查询不工作,java,sql,jpa,subquery,Java,Sql,Jpa,Subquery,我正在尝试执行JPA查询 select c from Chats c where c.userAndroidId=:userAndroidId and c.companyId = :companyId and c.id >= (select min(c2.id) from Chats c2 where c2.status=1 and c2.companyId = :companyId and c2.userAndroidId= :userAndroidId) union all (se
select c from Chats c where c.userAndroidId=:userAndroidId and c.companyId = :companyId and c.id >= (select min(c2.id) from Chats c2 where c2.status=1 and c2.companyId = :companyId
and c2.userAndroidId= :userAndroidId) union all
(select c3 from chats c3 where c3.userAndroidId=:userAndroidId and c3.companyId = :companyId and c3.id < (select min(c4.id) from Chats c4 where c4.status=1 and c4.companyId = :companyId and c4.userAndroidId=:userAndroidId) order by c3.id desc limit 2) order by c.id desc;
根据我的理解,它有两个变量,userandroid和companyId
我犯了一个错误
尚未设置所有命名参数:[id][从聊天室c中选择c
其中c.userandroid=:userandroid和c.companyId=:companyId
和id>:id顺序按id描述]
清理目标目录并重建项目。您正在运行的代码不是您在这里展示的代码,而且JPQL没有UNION ALL这样的东西。JPA规范在web上很容易找到