Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
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();
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com