-->
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: Query cache not working. Miss at each query
PostPosted: Tue Jan 11, 2005 5:40 am 
Beginner
Beginner

Joined: Fri Oct 10, 2003 10:30 am
Posts: 35
Location: Stockholm
Hi. I can't get the query cache to work. Can somebody please advice me how to debug the problem?
Each call of the same query "misses" and hits the db again.
Thans for any suggestion.
/roberto

Hibernate version:
2.1.3

Code between sessionFactory.openSession() and session.close():

final String query = "from Setting setting "
+ "where setting.key = :my_key and setting.type = :my_type "
+ "and setting.store = :my_store";

results = getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
return session.createQuery(query).setParameter(
"my_key", key).setParameter("my_store",
store).setParameter("my_type", type)
.setCacheRegion("settings").setCacheable(
true).list();

}
});

Name and version of the database you are using:
mysql Ver 12.22 Distrib 4.0.18, for pc-linux (i686)

Debug level Hibernate log excerpt:

2005-01-11 10:22:33,613 TP-Processor2 DEBUG [store.MemoryStore] - settingsCache: MemoryStore miss for sql: select setting0_.id as id, setting0_.settingkey as settingkey, setting0_.settingvalue as settingv3_, setting0_.settingtype as settingt4_, setting0_.storeid as storeid from setting setting0_ where (setting0_.settingkey=? )and(setting0_.settingtype=? )and(setting0_.storeid=? ); parameters: ; named parameters: {my_store=com.nmt.iws.entity.generated.Store@f648c[id=7], my_type=application, my_key=vat.percentage}
2005-01-11 10:22:33,640 TP-Processor2 DEBUG [store.MemoryStore] - settingsCache: MemoryStore miss for sql: select setting0_.id as id, setting0_.settingkey as settingkey, setting0_.settingvalue as settingv3_, setting0_.settingtype as settingt4_, setting0_.storeid as storeid from setting setting0_ where (setting0_.settingkey=? )and(setting0_.settingtype=? )and(setting0_.storeid=? ); parameters: ; named parameters: {my_store=com.nmt.iws.entity.generated.Store@f648c[id=7], my_type=application, my_key=vat.percentage}
2005-01-11 10:22:33,666 TP-Processor2 DEBUG [store.MemoryStore] - settingsCache: MemoryStore miss for sql: select setting0_.id as id, setting0_.settingkey as settingkey, setting0_.settingvalue as settingv3_, setting0_.settingtype as settingt4_, setting0_.storeid as storeid from setting setting0_ where (setting0_.settingkey=? )and(setting0_.settingtype=? )and(setting0_.storeid=? ); parameters: ; named parameters: {my_store=com.nmt.iws.entity.generated.Store@f648c[id=7], my_type=application, my_key=vat.percentage}


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.