-->
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.  [ 1 post ] 
Author Message
 Post subject: SQL Query is not getting to the database.
PostPosted: Thu Jul 24, 2008 1:08 pm 
Newbie

Joined: Thu Jul 24, 2008 12:58 pm
Posts: 1
Hi,
When I make a query with below code it's supposed to return a list of Transfer objects. It works well when I first invoke the call it returns the up to date records from the database however it always returns the very same result of the first call afterward.
I'm new to hibernate so your help will be appreciated .
thanks,
John

try{
Session session = getSession();
session.flush();
session.getSessionFactory().evictQueries();
Transaction tx = session.beginTransaction();
SQLQuery query = getSession().createSQLQuery("select id, value, "
+"max(timestamp) as \"timestamp\", tr_Id from transfer group by tr_Id");
query.addEntity(Transfer.class);
query.setCacheable(false);
query.setCacheMode(CacheMode.REFRESH);

tx.commit();
return query.list();
}catch(Exception e){
}


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

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.