The largest Interview Solution Library on the web


Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
The following is the syntax to get entity objects from a native sql query via addEntity() and using named SQL query.

String sql ="SELECT * FROM EMPLOYEE WHERE id = :employee_id";
SQLQuery query =session.createSQLQuery(sql);
query.addEntity(Employee.class);
query.setParameter("employee_id",10);
List results =query.list();
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com