-->
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: Clearing a query out of cache
PostPosted: Tue Feb 13, 2007 4:38 pm 
Newbie

Joined: Wed Dec 01, 2004 4:51 pm
Posts: 5
Hello,

I'm having problems with query results staying cached. We have outside processes updating the database, so we need a fresh read on certain queries each time. I've tried the following to force fresh reads, but still get stale results.

Code:
Query q = HibernateUtil.getSession().getNamedQuery("getBalance");
q.setCacheMode(CacheMode.REFRESH);
q.setString("provider", provider);
q.setString("customer", customer);
List balances = q.list();


I've also tried:

HibernateUtil.getSessionFactory().evictQueries();
Query q = HibernateUtil.getSession().getNamedQuery("getBalance");
q.setString("provider", provider);
q.setString("customer", customer);
List balances = q.list();

Hibernate version: 3.0

Mapping documents:

<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">bar</property>
<property name="hibernate.connection.url">jdbc:mysql://server1.mycompany.com:3306/myDb</property>
<property name="hibernate.connection.username">foo</property>
<property name="hibernate.dialect">com.talkplus.pmp.util.MySQL5Dialect</property>
<property name="hibernate.show_sql">false</property>
<property name="cache.use_query_cache">false</property>


</session-factory>

Name and version of the database you are using:
MySQL 5.0


What am I missing?

Thanks.


Kris


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.