-->
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: query.list() returns empty result after manual editing of DB
PostPosted: Wed Jan 05, 2011 10:23 pm 
Newbie

Joined: Wed Jan 05, 2011 10:06 pm
Posts: 2
1.) Initially the Image table in my DB has no records.
2.) I am executing the below method. The size is correctly displayed as zero.
3.) Now I am manually inserting 3 records through Mysql Query browser.
4.) Again I am executing the below method. ** watch** the size is still zero
5.) the manual changes I made are not getting reflected.

public String execute() {
Session session = HibernateUtil.getSession();
try {
String SQL_QUERY = "from Image"; // Image is a DTO and is mapped to a table in DB
Query query = session.createQuery(SQL_QUERY);
query.setCacheable(false);
List<Image> img = query.list();
System.out.println("size: "+img.size()); // size is STILL zero after manually inserting records in to the table
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
session.disconnect();
}


return "success";
}


Top
 Profile  
 
 Post subject: Re: query.list() returns empty result after manual editing of DB
PostPosted: Thu Jan 06, 2011 4:12 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
Hi there,

Do you have the second-level and/or query caches enabled? If so then its possible that the cached results are being returned.

Kate


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.