-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix Use constructor element and discriminator case element is resultMap property NPE #2353
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
base: master
Are you sure you want to change the base?
Conversation
Hello @JiHongYuan , All tests pass even if I revert the change you made to |
This reverts commit 748d296.
Hello @harawata, Thank you for your reply! I Revert Commit modifying test case and add a new independent test case. |
Thank you for the update. I could verify the problem. Although this change avoids NPE, it does not fix the real problem. In the test case, the constructor takes single <resultMap id="joinedPost" type="org.apache.ibatis.domain.blog.Post">
<constructor>
<idArg column="post_id" javaType="_int" />
</constructor>
... Note that when the constructor takes multiple arguments, the order of |
Hi @harawata,
right? This is my first PR,so dont now to do ... |
To define
And when using We cannot accept this PR because your fix (checking Please let me know if you have any further question. |
But,during the test javaType and name, all do fix problem. 1. nameexample1.1 Mapper
1.2 Model
result2. javaTypeexample1.1 Mapper
1.2 Model
resultSo from result, javaType and name, do fix the real problem. |
Constructor-mapping is not used for |
Oh ! You right. |
Could you please create a completely new test case with a new simpler mapper? |
OK, I will new test case with a new simpler mapper. |
I discover <resultMap id="joinedConstructorPost" type="org.apache.ibatis.domain.blog.Post">
<constructor>
<idArg column="post_id" javaType="_int"/>
<arg column="post_subject" javaType="string"/>
</constructor>
<discriminator javaType="int" column="draft">
<case value="1" resultMap="draftPost"/>
</discriminator>
</resultMap>
<resultMap id="draftPost" type="org.apache.ibatis.domain.blog.DraftPost" extends="joinedPost"/>
<resultMap id="joinedPost" type="org.apache.ibatis.domain.blog.Post">
<id property="id" column="post_id"/>
<result property="subject" column="post_subject"/>
// ...
<discriminator javaType="int" column="draft">
<case value="1" resultMap="draftPost"/>
</discriminator>
</resultMap> When review code, discover
But |
Could you do the following?
I want to keep the year numbers in the license headers of the test files as-is. (if it's easier, close this PR and open a new one without test changes) |
Use constructor element and discriminator case element is resultMap property
At create resultMap,not resultMap.type
Error Log: