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){
}
|