You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by IceMan81 <ge...@gmail.com> on 2010/04/13 00:21:08 UTC
Unable to get caching to work with IBatis - 3 (Build 242)
Hi,
I am using IBatis-3 build 242 (the latest available on the website) and I
find that though I set a cache policy, there is no caching being done by
IBatis.
In my mapper XML file I have the following line for cache configuration.
I have a function getStrategies() as seen below.
List getStrategies() {
final SqlSession session = sessionFactory.openSession();
try {
final StrategyMapper stratMapper = session.getMapper(
StrategyMapper.class);
return stratMapper.getStrategies();
} finally {
if (session != null) {
session.close();
}
}
}
In my unit tester, I call the getStrategies() method in a loop. For every
call to getStrategies(), I get the following log message when I turned on
DEBUG logging.
2010-04-12 17:06:35,337 [Main Thread] (Log4jImpl.java:27) DEBUG
java.sql.Connection - ooo Connection Opened
2010-04-12 17:06:35,416 [Main Thread] (Log4jImpl.java:27) DEBUG
org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio
[com.aqr.data.refdata.StrategyMapper]: 0.0
2010-04-12 17:06:47,838 [Main Thread] (Log4jImpl.java:27) DEBUG
java.sql.Connection - ooo Connection Opened
2010-04-12 17:06:47,838 [Main Thread] (Log4jImpl.java:27) DEBUG
org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio
[com.aqr.data.refdata.StrategyMapper]: 0.0
I am not sure why caching is not working. Please correct me if I am using
the caching mechanism incorrectly.
Thanks,
Gesly
--
View this message in context: http://old.nabble.com/Unable-to-get-caching-to-work-with-IBatis---3-%28Build-242%29-tp28219194p28219194.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.