MyBatis Query exception-error querying database. Cause:java.lang.ClassCastException:org.apache.ibatis.executor.ExecutionPlaceholder cannot is cast to Java.util.List

Source: Internet
Author: User



Background, MyBatis query when directly take the sqlsession, no packaging into sqlsessiontemplate, did not go Spring provides agent.



Then I wrote the code to get sqlsession without taking into account the concurrency situation, causing sqlsession to build too much







When the concurrency is large, the query error


 
 
org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List
### The error may exist in class path resource [mybatis/ConVideoInfoMapper.xml]
### The error may involve com.letv.mms.core.dao.IConVideoInfoDao.selectById
### The error occurred while executing a query
### Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.1.1.jar:3.1.1]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104) ~[mybatis-3.1.1.jar:3.1.1]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95) ~[mybatis-3.1.1.jar:3.1.1]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:59) ~[mybatis-3.1.1.jar:3.1.1]
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:95) ~[mybatis-3.1.1.jar:3.1.1]
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40) ~[mybatis-3.1.1.jar:3.1.1]


Workaround, give spring to manage MyBatis, and use Sqlsessiontemplate.



MyBatis Query exception-error querying database. Cause:java.lang.ClassCastException:org.apache.ibatis.executor.ExecutionPlaceholder cannot is cast to Java.util.List


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.