ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From IceMan81 <gesly.geo...@gmail.com>
Subject Unable to get caching to work with IBatis - 3 (Build 242)
Date Mon, 12 Apr 2010 22:21:08 GMT

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.

Mime
View raw message