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]
4
  • java2s.com/Tutorials/Java/JPA/4860__JPA_TypedQuery.htm Commented Sep 15, 2016 at 9:17
  • stackoverflow.com/questions/10807496/… Commented Sep 15, 2016 at 9:22
  • thank you.however i used native query and it worked. Commented Sep 26, 2016 at 6:20
  • I used native query for this. i stored the list of object as follows .. "List<Object[]> 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 Commented Sep 27, 2016 at 11:15

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.