2017-08-29 136 views
0

我有3個名爲Employee,Office,Department的表。 員工有4個字段,如id,Emp_Name,Salary,JoiningDate。 辦公室有3個字段,如ID,EMP_ID,位置 處有ID,Off_id,DEPT_NAME,EMP_ID使用Session.CreateCriteria休眠查詢

SQL查詢,

SELECT 
    DISTINCT TOP 10 this.id as Emp_id, Emp_Name,Salary,Location,Dept_name 
FROM 
    Employee this 
INNER JOIN 
    Office O ON this_id = O.id 
INNER JOIN 
    Department d on d.Emp_id = this.id 
ORDER BY this.id 

能否請你幫我弄使用Session相當於Hibernate查詢語言.CreateCriteria(Employee.class,「Employee」) 這可能會非常有幫助。

回答