Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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 select查询_Java_Jpa_Hql_Entitymanager - Fatal编程技术网

Java 具有多个值的JPA select查询

Java 具有多个值的JPA select查询,java,jpa,hql,entitymanager,Java,Jpa,Hql,Entitymanager,我不能执行这句话 select s.id,s.a.id,s.siteName from site s where s.a.id=:b 子问题的解决方法: 使用这些转换为整数新整数((int)对象[0])谢谢。不过,我使用了本机查询,它工作正常。为此,我使用了本机查询。我将对象列表存储如下。。“List obj=Repository.findId(Id);”我试图获取这些值,但没有成功。“Site Site;for(Object[]Object:obj){Site=new Site();Sit

我不能执行这句话

select s.id,s.a.id,s.siteName from site  s where s.a.id=:b

子问题的解决方法:
使用这些转换为整数
新整数((int)对象[0])

谢谢。不过,我使用了本机查询,它工作正常。为此,我使用了本机查询。我将对象列表存储如下。。“List obj=Repository.findId(Id);”我试图获取这些值,但没有成功。“Site Site;for(Object[]Object:obj){Site=new Site();Site.setSiteId(Integer.parseInt(Object[0]));}。还有其他方法将对象转换为整数吗?”
ERROR:
Cannot create TypedQuery for query with more than one return using requested result type [com.a.b.entity.site]