I need to disable the cache of MyBatis because I'm altering my database in other ways and want that MyBatis has always the latest version of my data ready. I tried numerous ways to disable it:
- Calling
SqlSession.clearCache()
before every query - Adding
<setting name="cacheEnabled" value="false" />
to mybatis-config.xml - Adding
<setting name="localCacheScope" value="STATEMENT" />
to mybatis-config.xml - Adding
@Options(flushCache = Options.FlushCachePolicy.TRUE, useCache = false)
to every statement
Nothing works and I always get old data on queries.