hi, i have a problem in query using hibernate.
i already have a sql query from four tables, and its successfully tested in my oracle (i use oracle db).
Code:
select e.empidentitynum
from (((Hrm_Employee e join Hrm_Officialhistory o on e.empid = o.empid)
join Hrm_Jobtitles j on j.jobtitleid = o.newjobtitle )
join Hrm_Jobspecification s on s.jobspecid = j.jobspecid )
where s.jobspecname like 'Manager'
but when i use it in createSQLQuery, the test failed.
Code:
Query q = session.createSQLQuery(
"select e.empidentitynum"+
"from (((Hrm_Employee e join Hrm_Officialhistory o on e.empid = o.empid)"+
"join Hrm_Jobtitles j on j.jobtitleid = o.newjobtitle )"+
"join Hrm_Jobspecification s on s.jobspecid = j.jobspecid )"+
"where s.jobspecname like 'Manager'")
.addEntity(HrmEmployee.class)
.addEntity(HrmOfficialhistory.class)
.addEntity(HrmJobspecification.class)
.addEntity(HrmJobtitles.class);
so i make a simple native query from 2 tables and it work.
then i make a simple native query from 3 tables and it doesn't work.
how can i make a query from more than 2 tables?
thanks a lot before.