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]