javamybatis

Easiest way to verify MyBatis 3.x caching is working properly


I'm trying to set up caching for a small MyBatis & Spring app and following their pdf doc my xml mapper contains

<cache />

Configuration xml file at the top has settings as follows:

    <settings>
    <setting name="cacheEnabled" value="true" />
</settings>

logging with log4j is set for DEBUG, but I see no indications that cache is working as expected.

What am I missing here?


Solution

  • ... that was easy:

    log4j.logger.org.apache.ibatis=DEBUG
    log4j.logger.org.apache.ibatis.common.jdbc.SimpleDataSource=DEBUG
    log4j.logger.org.apache.ibatis.common.jdbc.ScriptRunner=DEBUG
    log4j.logger.org.apache.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
    log4j.logger.org.apache.ibatis.cache.decorators.LoggingCache=DEBUG
    log4j.logger.java.sql.Connection=DEBUG
    log4j.logger.java.sql.Statement=DEBUG
    log4j.logger.java.sql.PreparedStatement=DEBUG
    log4j.logger.java.sql.ResultSet=DEBUG
    

    ... the rest: not so much. Just can't get the caching to work.

    I think it's time to switch to something else. Check out their mailing list and draw your own conclusions.