2017-08-29 63 views
2

我有此查詢在JPA右加入JPA查詢未能得到確切的輸出中

Employee表

id,....,location_id (id 1,2,3,4 assigned to location id 1)

EmployeeMaster表

id,.....,date, employee_id(employee_id 1 and 2 having records in this table) 

JPA查詢

問題
select me,ms from EmployeeMaster ms right join ms.employee me where ms.date between ?2 and ?3 and me.location.id = ?4 

輸出

employeeMaster,employee1 
employeeMaster,employee2 

由於具有日期

之間EmployeeMaster表中的記錄只有兩名員工我希望輸出像

employeeMaster,employee1 
employeeMaster,employee2 
null,employee3 
null,employee4 

請幫我解決這個

感謝。

回答

0

而不是檢索employeeMaster檢索員工,你會得到你的結果。

+0

仍然得到相同的結果。 –

+0

你是如何執行我的建議的? –

+0

從EmployeeMaster ms中選擇我的權利加入ms.employee me,其中ms.date介於?2和?3之間以及me.location.id =?4 –