Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JPA子查询不工作_Java_Sql_Jpa_Subquery - Fatal编程技术网

Java 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

我正在尝试执行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 
(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上很容易找到