-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Offer configuration to disable autoMappingsCache in DefaultResultSetHandler #1968
Comments
Hello @GitHanter , Thanks for the demo project! I was aware that there might be issues like this caused by the auto-mapping cache. <resultMap id="multiResultSetMap" type="test.User" autoMapping="true">
<id column="id" />
<result property="name" column="name" />
</resultMap>
<resultMap id="multiResultSetMapCopy" type="test.User" extends="multiResultSetMap">
</resultMap>
<select id="getMultipleResultSet"
resultMap="anotherEntityMap,multiResultSetMap,multiResultSetMapCopy">
.. Compared to the proposed option, this approach seems better because you won't lose the benefit of auto-mapping cache. |
Yes, this work around can solve this problem, but some of our legacy project has four to five ResultSets mapped to the same ResultMap, and it'll be nice to have this configuration to turn the automapping cache off. Anyway, you are right, this can solve the issue and use the automapping cahe to maximize performance. Thanks. |
Closing for now. We might reconsider if this turned out to be a frequently requested feature. |
MyBatis version
3.5.3
Database vendor and version
SQL Server 2012
Test case or example project
<select id="selectMultiResultSet" resultMap="AMap,BMap,BMap">
BMap
javaType has a propertyaProperty
The ResultSets of the two
BMap
is different (with different columns), e.gThe first BMap ResultSet (BResultSet1) is
columnA, columnB
The second BMap ResultSet (BResultSet2) is
columnb, columnC
When the
DefaultResultSetHandler
encounter the BResultSet1, it'll cache theaProperty
on theautoMappingsCache
,When the
DefaultResultSetHandler
handle the BResultSet2 for the secondBMap
, it'll use theaProperty
to retrieve value from BResultSet2, which doesn't exit, and JDBC Driver will complainThe column name aProperty is not valid.
Possible fix
We can add a configuration attribute to
And change method
createAutomaticMappings
inDefaultResultSetHandler
a little bit likeDemo test on PR92
The text was updated successfully, but these errors were encountered: