0

I have 3 tables named Employee, Office, Department. Employee has 4 fields such as id, Emp_Name, Salary,JoiningDate. Office has 3 fields such as id, Emp_id, Location Department has id, Off_id, Dept_Name,Emp_id

SQl Query,

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

Could you please help me to get the equivalent Hibernate Query Language using Session.CreateCriteria (Employee.class,"Employee") That could be very helpful.

Surenthiran T
  • 11
  • 1
  • 7

1 Answers1

0

The inner joins in hql are mostly the same like in you query, but you can't have pagination in hql. More about here: https://stackoverflow.com/a/840108/6521788

And here you can find all the thinds you will need to write the query by your own :)

https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html#queryhql-ordering