I use reflection to run a function in a Dao. However, after : List<Hotel> size = (List<Hotel>)session.createQuery("from Hotel t").list(); , I can see the sql is printed out in MyEclipse console, but the program is stop here.
The code snippet is as follows:
public class AppServiceDao {
public AppServiceDao(){} private SessionFactory getSessionFactory() { return (SessionFactory)SpringContextUtils.getBean("sessio nFactory"); }
@SuppressWarnings({ "unchecked", "deprecation" }) private String HotelBySeq(Long city, Integer startNo, Integer endNo) throws HibernateException,SQLException{ StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
Session session = this.getSessionFactory().openSession();//.getCurrentSession(); session.beginTransaction().begin(); String hql="from Hotel t "; List<Hotel> size = (List<Hotel>)session.createQuery(hql).list(); session.flush(); session.clear(); session.close(); .................................................. ..... I try .getCurrentSession(); but it has same problem. How to get data?
|