0
我已經使用Hibernate執行查詢,該查詢使用where子句引用單個表。在休眠狀態下執行復雜查詢
我選擇在SQL下面的查詢:
SELECT URN.ID,
URN.USERNAME,
(SELECT NAME FROM CITY WHERE ID=URN.CITY_ID
) AS CITY ,
(SELECT NAME FROM STATE WHERE ID=URN.STATE_ID) AS STATE,
(SELECT NAME FROM COUNTRY WHERE ID = URN.COUNTRY_ID) AS COUNTRY
FROM USERREGISTRATION_NEW URN
URN.CITY_ID,URN.STATE_ID,URN.COUNTRY_ID包含數值。
城市,州,國家名稱從相應的表上檢索傳遞數字ID。
那麼,我該如何在Hibernate中編寫這個查詢呢?
此外,我不明白多對一,等教程?
我採取了參考從Vaannila