MyBatis-Exception:org.apache.ibatis.exceptions.PersistenceException

错误信息如下:

HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

type Exception report

message org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database. Cause: java.lang.reflect.UndeclaredThrowableException
### The error may exist in class path resource [mybatis/mapper/SysTradeTradeMapper.xml]
### The error may involve com.zito.b2c.order.mapper.SysTradeTradeMapper.getOperatingSituation-Inline
### The error occurred while setting parameters
### Cause: java.lang.reflect.UndeclaredThrowableException
### Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

通过查看错误信息,可以发现"The error occurred while setting parameters",错误是参数传入的时候出的错。

Mapper接口方法如下:

public Map<String,String> queryOrder(@Param("shopId") int shopId, @Param("shopName") String shopName);

Mapper.xml中方法的配置:

<select id="queryOrder"  parameterType="String"  resultType="java.util.Map">

</select>

因为传入的参数既有Sting又有int,而我们在xml中配置的传入参数类型只有Sting,所以会报传入参数类型不匹配。

再由对个参数传入,并且传入参数的类型不一致时,可以去掉  parameterType   

 

转载于:https://www.cnblogs.com/lashou/p/6089011.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值