MyBatis - nested results are not updated after clearing the cache

I have 2 mapperA and mapperB mappings.

mapperA has result map A, which contains only result elements (simple properties) and is cached in its own namespace.

mapperB has a B result map that associates with A (select statement findById) and is also cached in its own namespace.

Problem:

  • mapperB.findById (loads B and related A - both are cached)
  • mapperA.findById (selection A is not made).
  • mapperA.update (updated some A-cache A flushed)
  • mapperA.findById (selection made - loaded A updated)
  • mapperB.findById- here's the problem - the selection is not made because B is cached. But it is cached with instances of A. This instance does not reflect the update. To load the current instance of A., you must perform a selection / cache search.

My question is:

, .

:

, A B mapper , A A B. , 10 - . 1 B - . B , A , .

+4
1

- .

mapperA:

< mapper namespace="mapperA">

< cache/>

...

mapperB:

< mapper namespace="mapperB">

< cache-ref namespace="mapperA"/>

...
0

All Articles