如何执行休眠查询?

时间:2019-07-10 16:12:15

标签: hibernate

SQLQuery query = session.createSQLQuery("select e.ename from Employee e");

//query.addEntity(Employee.class);
i = ()query.addEntity(Employee.class);
System.out.println("a");
List<Object[]> list = query.list();
System.out.println("b");
Iterator itr = list.iterator();
while (itr.hasNext())
{
    //String ename = (String)itr.next();
    System.out.println("ename" + ":" + itr.next());
}

0 个答案:

没有答案