Could not find parameter map java.lang.Long

xiaoxiao2021-02-27  421

启动Mybatis报错如下:

java.lang.RuntimeException: org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map java.lang.Long org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map java.lang.Long at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementParameterMap(MapperBuilderAssistant.java:319) at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:283) at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:107) at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:698) at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:668) at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:663)

经发现,找到出错原因,是Mybatis配置文件语句有问题,原语句为:

<select id="getSysFlodersByComId" parameterMap="java.lang.Long" resultType="com.sjdf.erp.facade.bean.sys.SysFloder"> SELECT * FROM sys_floder WHERE comId=#{comId}; </select>

原因:java.lang.Long类型不能用parameterMap修饰,改为parameterType即可,故修改后的正确语句为:

<select id="getSysFlodersByComId" parameterType="java.lang.Long" resultType="com.sjdf.erp.facade.bean.sys.SysFloder"> SELECT * FROM sys_floder WHERE comId=#{comId}; </select>

 

 

 

 

 

 

转载请注明原文地址: https://www.6miu.com/read-1458.html

最新回复(0)