-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to get data?
PostPosted: Wed Jan 30, 2013 12:01 am 
Newbie

Joined: Fri Jul 29, 2011 1:06 am
Posts: 2
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?


Top
 Profile  
 
 Post subject: Re: How to get data?
PostPosted: Wed Jan 30, 2013 3:41 am 
Newbie

Joined: Thu Jun 24, 2010 8:24 am
Posts: 5
May, i know what do you mean by "the program is stop here".

_________________
Thanks,
Sandeep Bhardwaj


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.