I think I have found a solution for this. I will use .createSQLQuery () and use the following native SQL :
Code:
select count(ec.INT_ID) as count, e.INT_ID as eid from LU_EMPLOYEE_TO_COMPETENCY ec join TBL_EMPLOYEE e on e.INT_ID = ec.INT_EMPLOYEE_ID where ec.INT_COMPETENCY_ID in (select (pc.INT_COMPETENCY_ID) from LU_COMPETENCY_TO_PROFILE pc where pc.INT_PROFILE_ID="8") GROUP BY eid
And then pull the values out using this :
Code:
.addScalar("count",Hibernate.INTEGER).addScalar("eid",Hibernate.INTEGER).list();
Code:
Object[] obj = llist.get(0);
System.out.println(obj[0]);
System.out.println(obj[1]);