java - MyBatis - java.lang.IllegalArgumentException:映射语句集合已经包含值
问题描述
我的应用程序使用 Spring 和 MyBatis。在将包更改为用作 ResultType 的类之前,我没有例外。从那时起,我在启动我的应用程序时收到以下错误:
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for app2Check.core.dao.ThemeSentimentDAO.getSplitMatchingThemes
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:782)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:754)
at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:578)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:288)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:107)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 67 more
这是我的 xml 映射器(我不得不审查查询,但它们没有改变):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="app2Check.core.dao.ThemeSentimentDAO">
<select id="getSplitMatchingThemes" resultType="xyz.objects.sentences.SplitSent"><!-- Previously resultType="xyz.sentences.SplitSent" -->
SELECT TOP (#{numSplitPerPage})
...
<if test = "redo == false">
...
</if>
WHERE (
<foreach collection="themes" item="t" index="index" separator=" OR ">
(
..
)
</foreach>
)
</select>
<select id="getThemes" resultType="xyz.objects.Theme">
...
</select>
<select id="countSplitMatchingTheme" resultType="xyz.utils.SplitCount">
...
</select>
</mapper>
这是我的映射器界面:
public interface ThemeSentimentDAO {
public List<Theme> getThemes(@Param("appId") String appId);
public List<SplitFeedback> getSplitMatchingThemes(
@Param("appId") String appId,
@Param("customerCare") String customerCare,
@Param("redo") boolean redo,
@Param("analysisDate") Timestamp analysisDate,
@Param("themes") List<Theme> themes,
@Param("numSplitPerPage") int numSplitPerPage
);
public SplitCount countSplitMatchingTheme(
@Param("appId") String appId,
@Param("customerCare") String customerCare,
@Param("redo") boolean redo,
@Param("themes") List<Theme> themes
);
}
解决方案
推荐阅读
- google-apps-script - 使用谷歌应用脚本将文件从谷歌驱动器上传到外部 api
- vue.js - "prop" 是未定义的,虽然它被正确传递
- excel - Excel中的自定义文本使用宏作为两个数字之间的值
- python - 在 Python 中同时运行两个函数
- javascript - Luxon.js 获取现在和输入日期之间的差异(以年为单位)
- java - 在一天中的固定时间后不会取消选中 SwitchCompat
- angular - 组件不加载 ng 属性 ionic
- android - 如何测量手机与被摄物体之间的距离?
- google-cloud-platform - 在 Google Cloud DataProc 上安排 cron 作业
- jquery - 如何在 jQuery 中从 JSON 文件中读取单个数据?