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

I cannot execute this statement.

ERROR:
Cannot create TypedQuery for query with more than one return using requested result type [com.a.b.entity.site]
Abhishek Ramachandran
  • 1,132
  • 11
  • 32
Tom jaison
  • 205
  • 2
  • 9
  • http://www.java2s.com/Tutorials/Java/JPA/4860__JPA_TypedQuery.htm – Fran Montero Sep 15 '16 at 09:17
  • http://stackoverflow.com/questions/10807496/error-cannot-create-typedquery-for-query-with-more-than-one-return – hasnae Sep 15 '16 at 09:22
  • thank you.however i used native query and it worked. – Tom jaison Sep 26 '16 at 06:20
  • I used native query for this. i stored the list of object as follows .. "List obj = Repository.findId(Id); " and i tried to get the values but it didint work. "Site site; for (Object[] object : obj) { site = new Site(); site.setSiteId(Integer.parseInt(object[0]))); } . is there any other way make an object to integer – Tom jaison Sep 27 '16 at 11:15

1 Answers1

2

Workaround for your sub question: use these to convert to integer new Integer((int) object[0])

Abhishek Ramachandran
  • 1,132
  • 11
  • 32