Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two xml with same namespace interface, cache uncleared when invoke update in second xml #1599

Closed
DC-ET opened this issue Jul 10, 2019 · 3 comments

Comments

@DC-ET
Copy link

DC-ET commented Jul 10, 2019

MyBatis version

3.4.4 (Tried 3.5.1, get the same result)

Database vendor and version

MySQL5.7 Innodb

Test case or example project

https://gitee.com/yangjiayi/mybatis-issue-test

Steps to reproduce

Create two Mapper.xml that with same namespace interface, such as
image

Add cache node to IssueMapper.xml, like this
image

Step1. invoke select method that implemented in IssueMapper.xml, Hit cache false.

Step2. invoke update method that implemented in IssueMapperExt.xml.

Step3. invoke select method that implemented in IssueMapper.xml again, Hit cache true!

Expected result

Step3 get the lastest data in database

Actual result

Step3 get same data with step1, not latest data in database

@DC-ET
Copy link
Author

DC-ET commented Jul 10, 2019

I try to add cache node in both xml, but it throw an Exception
image

@harawata
Copy link
Member

Adding <cache-ref /> to IssueMapperExt.xml may fix the problem.

<cache-ref namespace="com.zoi7.mybatis.issue.test.mapper.IssueMapper" />

@DC-ET
Copy link
Author

DC-ET commented Jul 10, 2019

Adding <cache-ref /> to IssueMapperExt.xml may fix the problem.

<cache-ref namespace="com.zoi7.mybatis.issue.test.mapper.IssueMapper" />

Amazing! it works, so thanks!

@DC-ET DC-ET closed this as completed Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants