The above queries were all about returning scalar values, basically returning the "raw" values from the resultset. The following is the syntax to get entity objects as a whole from a native sql query via addEntity().
String sql ="SELECT * FROM EMPLOYEE";
SQLQuery query =session.createSQLQuery(sql); query.addEntity(Employee.class); List results =query.list(); |