HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibati...

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

type Exception reportspring

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

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

exceptionapp

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.Stringthis

經過查看錯誤信息,能夠發現"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">server

</select>
由於傳入的參數既有Sting又有int,而咱們在xml中配置的傳入參數類型只有Sting,因此會報傳入參數類型不匹配。
再由對個參數傳入,而且傳入參數的類型不一致時,能夠去掉 parameterType xml

相關文章
相關標籤/搜索