2016-09-15 93 views
1
select s.id,s.a.id,s.siteName from site s where s.a.id=:b 

我無法執行此語句。JPA選擇具有多個值的查詢

ERROR: 
Cannot create TypedQuery for query with more than one return using requested result type [com.a.b.entity.site] 
+0

http://www.java2s.com/Tutorials/Java/JPA/4860__JPA_TypedQuery.htm –

+0

的http://計算器。 com/questions/10807496/error-can-create-type -query-for-query-with-more-one-return – hasnae

+0

謝謝你,但我用原生查詢,它工作。 –

回答

2

解決方法爲您的子問題: 使用這些轉換爲整數new Integer((int) object[0])

+1

它的工作原理,謝謝 –