2.X
3.X
Query q=session.createSQLQuery(“select * from CUSTOMERS c where c.NAME like :name”,”c”,Customer.class);
q.setString(“name”,”zhang%”);
//q.setString(0,”zhang%”);
List result=q.list();
3.X
Query q=session.createSQLQuery(“select * from CUSTOMERS c where c.NAME like :name”).addEntity(Customer.class);
q.setString(“name”,”zhang%”);
//q.setString(0,”zhang%”);
List result=q.list();