0
我有興趣使用返回實體/模型結果的Hibernate INNER JOINS。Hibernate INNER JOIN返回實體/模型結果
在Hibernate Community Documentation,他們寫道:
或者 - 假設類Family有一個合適的構造函數 - 作爲實際的類型安全的Java對象:
select new Family(mother, mate, offspr) from DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr
對於我的生活,我一直無法構建適當的構造函數。我想查詢
Select new Participant(part, addr.adddressType)
from Participant part
INNER JOIN part.adddresses addr
我應該創建一個新的Java類,讓我們說Participant_Address.java,上面寫着這樣的:
Select new Participant_Address (part, addr.adddressType)
from Participant part
INNER JOIN part.adddresses addr
With constructor:
public Participant_Address(new Participant(...), String addressType)
看看[這個](http://stackoverflow.com/questions/4027805/new-object-with-hq l)後,你的問題已經被回答 –
halfer ...爲什麼編輯? – emm