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