SSM时遇到的异常(10)——...Cause: ...ClassCastException: java.lang.String cannot be cast to java.lang.Integer

25 篇文章 0 订阅
13 篇文章 0 订阅

JDK1.7+Tomcat7.0+Eclipse+SSM+Bootstrap(含Bootstrap Table)   

三月 07, 2019 8:56:18 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [SpringMVC] in context with path [/HTGlory] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [F:\ALL_Course\10Activiti\Ecli\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\HTGlory\WEB-INF\classes\com\ht\lym\mapper\StudentJobsDao.xml]
### The error may involve com.ht.lym.mapper.StudentJobsDao.lists-Inline
### The error occurred while setting parameters
### SQL: select j.*,s.studName,c.className from studentjobs j inner join student s on j.studId=s.studId     left join cls c on j.classId=c.classId where studName like concat('%',?,'%') limit ?,?;
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer] with root cause
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
	at org.apache.ibatis.type.IntegerTypeHandler.setNonNullParameter(IntegerTypeHandler.java:26)
	at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:50)	

异常里讲的提示得很明显了:

发现,还真是有错误!!! 

 上图(StudentJobsDao.java)和 下图(StudentJobsDao.xml)

改:

 补充:

为什么会出现cannot be cast to java.lang.String(另外问题的解决方案)

推荐:[也是parameterType属性错误使用导致的问题]

IllegalStateException: Optional int parameter 'id' is present but cannot be translate

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yvette_QIU

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值