-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Circularly referenced resultMap is filled with ancestor object even when columnPrefix is specified. #215
Comments
3.2.3 is ok, 3.2.4 - 3.2.7 has this bug |
Your resultMap contains circular reference. <resultMap id="user" type="User">
<id property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
<resultMap id="userAndSuperior" type="User" extends="user">
<association property="superior" resultMap="user" columnPrefix="superior_" />
</resultMap>
<select id="find" parameterType="long" resultMap="userAndSuperior">
select 1 as id, 'a' as name, 2 as superior_id , 'b' as superior_name from dual
</select> |
+1 for the issue: I am having the same issue with a similar design in 3.2.7. I will use harawata's pattern as a workaround, but I think we are losing some of the flexibility of mappers (and columnPrefix becomes obsolete). --> Might be interesting to solve this |
A test case contributed by another user in the forum seems to be the test case for this issue. |
…orResult does not have columnPrefix attribute, so MyBatis tries to lookup ancestor stored under the same resultMapID.
…ated to mybatis#39 as well.
… referenced resultMap will be filled with ancestor only when the columnPrefix attribute is not specified for the nested result mapping. 2) When columnPrefix is specified for a nested result mapping and there is no column with that prefix in the result set, skip filling the nested result mapping to prevent stack overflow.
…he authorResult does not have columnPrefix attribute, so MyBatis tries to lookup ancestor stored under the same resultMapID.
mapper :
java :
result :
The text was updated successfully, but these errors were encountered: