There's lots of information in the docs about native SQL queries. Check out
16.1. Using a SQLQuery
Basically, if you're expecting to get an entity you need to use addEntity().
e.g.
Code:
List<Cat> cats = (List<Cat>)sess.createSQLQuery("SELECT * FROM CATS").addEntity(Cat.class).list();
However, judging by your query I'm guessing DepartmentBean isn't an entity.
You could try using HQL like this:
Code:
Query query = getSession().createQuery("select new DepartmentBean(i.dept_id, func_dept(i.dept_id)) from Department i where i.dept_status_id=:deptStatusId");
List<DepartmentBean> beans = (List<DepartmentBean>)query.list();
DepartmentBean would need a constructor to match the query params:
Code:
public DepartmentBean(int deptId, int numDepts) {
...
}