Type Handler Issue in MyBatis of Spring Boot

I have a problem about Type Handler Issue in MyBatis of Spring Boot. How can I fix it?
9 Replies
JavaBot
JavaBot3mo ago
This post has been reserved for your question.
Hey @direct_x_34! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
direct_x_34
direct_x_34OP3mo ago
@Expert Can you help me?
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
direct_x_34
direct_x_34OP2mo ago
@Chichko Dibel @Carter @tjoener Can anyone help me fix the issue?
<select id="getTaskStatusCounts" resultMap="taskStatusCountResultMap" parameterType="com.example.model.QueryRequest">
SELECT
tt.region_name_en AS region,
tt.office_name_en AS office,

CONCAT(
'{',
<foreach collection="years" item="year" separator=",">
<foreach collection="months" item="month" separator=",">
CONCAT('"month_${year}_${month}":',
COUNT(CASE WHEN SUBSTRING(tt.task_finish_time, 1, 7) = CONCAT(#{year}, '-', #{month}) THEN 1 END))
</foreach>
</foreach>,
'}'
) AS monthlyCounts

FROM
task_list tt
<include refid="queryTaskStatusCondition"/>
GROUP BY
tt.region_name_en,
tt.office_name_en
ORDER BY
tt.region_name_en ASC;
</select>
<select id="getTaskStatusCounts" resultMap="taskStatusCountResultMap" parameterType="com.example.model.QueryRequest">
SELECT
tt.region_name_en AS region,
tt.office_name_en AS office,

CONCAT(
'{',
<foreach collection="years" item="year" separator=",">
<foreach collection="months" item="month" separator=",">
CONCAT('"month_${year}_${month}":',
COUNT(CASE WHEN SUBSTRING(tt.task_finish_time, 1, 7) = CONCAT(#{year}, '-', #{month}) THEN 1 END))
</foreach>
</foreach>,
'}'
) AS monthlyCounts

FROM
task_list tt
<include refid="queryTaskStatusCondition"/>
GROUP BY
tt.region_name_en,
tt.office_name_en
ORDER BY
tt.region_name_en ASC;
</select>
I also revised it but I get this error message
ause: java.sql.SQLException: Error converting JSON to Map
; uncategorized SQLException; SQL state [null]; error code [0]; Error converting JSON to Map; nested exception is java.sql.SQLException: Error converting JSON to Map] with root cause
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
at [Source: (String)"{"month_2022_01":0"month_2022_02":0"month_2022_03":0"month_2023_01":3"month_2023_02":4"month_2023_03":8}"; line: 1, column: 20]
ause: java.sql.SQLException: Error converting JSON to Map
; uncategorized SQLException; SQL state [null]; error code [0]; Error converting JSON to Map; nested exception is java.sql.SQLException: Error converting JSON to Map] with root cause
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
at [Source: (String)"{"month_2022_01":0"month_2022_02":0"month_2022_03":0"month_2023_01":3"month_2023_02":4"month_2023_03":8}"; line: 1, column: 20]
Carter
Carter2mo ago
if you can please create a MRE (minimal reproducible example) of the problem, I can help.
direct_x_34
direct_x_34OP2mo ago
@Carter I already shared my issue.
Carter
Carter2mo ago
showing a couple hundred lines of code and a stack trace isn't exactly an MRE, especially when it comes to Spring. Try and narrow down what is actually causing the issue If you have more questions feel free to ask.
direct_x_34
direct_x_34OP2mo ago
@Carter I already mentioned about it in the file.
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?