SSM+Bootstrap+Tomcat8.5+Eclipse+JDK1.8
2019-08-06 14:48:59 DEBUG [com.alibaba.druid.pool.PreparedStatementPool:160]- {conn-10001, pstmt-20005} exit cache
2019-08-06 14:48:59 DEBUG [com.github.miemiedev.mybatis.paginator.support.SQLHelp:52]- Total count SQL [select count(1) from (SELECT
t.LKH, t.LKMC, t.CJJG, t.QXDM, t.ZDYFZ, (CASE t.ZDLK WHEN 1 THEN '是' WHEN 0 THEN '否'END) AS zdlk, t.LX, t.XCXS, t.DLZL, t.DLLX, t.LKZT, t.CDS, t.JD, t.WD, t.QZ,
t.KZZD1, t.KZZD2, t.WFDD, t.LDDM, t.LDMC, t.DDMS, t.XH, t.JSRQ, t.CJDW, t.TZDW, t.XSFX, t.WFDD1, t.LDDM1, t.DDMS1,
t.LKMC1, t.FLG, t.QYZT, t.LK_YJ_FLG, t.LK_YJZ, t.LK_YJ_MIN, t.LK_YJ_MAX, t.LKSHZT, t.BZ, t.CJSJ, t.CJR,
t.GXSJ, t.GXR, t.ZT, t.WD1, t.JD1, t.LKWFLX, t.BQ, t.QXSBBM
FROM XX t
WHERE t.zt = 1
AND t.zdlk = ?
ORDER BY t.cjsj DESC) tmp_count]
2019-08-06 14:48:59 DEBUG [com.github.miemiedev.mybatis.paginator.support.SQLHelp:53]- Total count Parameters: {wxdw=, zdyfz=, qxdm=, lkmc=, lkh=, cjjg=, sblx=, zdlk=0, sbnf=, dlzl=, dllx=, lkwflx=, sbzt=}
2019-08-06 14:48:59 DEBUG [com.github.miemiedev.mybatis.paginator.support.SQLHelp:69]- Total count: 16568
2019-08-06 14:48:59 DEBUG [com.alibaba.druid.pool.PreparedStatementPool:129]- {conn-10003, pstmt-20006} enter cache
2019-08-06 14:48:59 DEBUG [org.mybatis.spring.SqlSessionUtils:168]- Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2c50d568]
2019-08-06 14:48:59 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils:327]- Returning JDBC Connection to DataSource
2019-08-06 14:48:59 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:134]- Resolving exception from handler [public java.lang.Object com.lst.controller.JcxxLkxxViewController2.queryList(java.lang.Integer,java.lang.Integer,javax.servlet.http.HttpServletRequest)]: 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 file [E:\Work_QYF\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\NdManagent\WEB-INF\classes\com\lst\mapping\XXMapper2.xml]
### The error may involve com.lst.dao.XXMapper2.queryListByMap-Inline
### The error occurred while setting parameters
### SQL: select * from ( SELECT t.LKH, t.LKMC, t.CJJG, t.QXDM, t.ZDYFZ, (CASE t.ZDLK WHEN 1 THEN '是' WHEN 0 THEN '否'END) AS zdlk, t.LX, t.XCXS, t.DLZL, t.DLLX, t.LKZT, t.CDS, t.JD, t.WD, t.QZ, t.KZZD1, t.KZZD2, t.WFDD, t.LDDM, t.LDMC, t.DDMS, t.XH, t.JSRQ, t.CJDW, t.TZDW, t.XSFX, t.WFDD1, t.LDDM1, t.DDMS1, t.LKMC1, t.FLG, t.QYZT, t.LK_YJ_FLG, t.LK_YJZ, t.LK_YJ_MIN, t.LK_YJ_MAX, t.LKSHZT, t.BZ, t.CJSJ, t.CJR, t.GXSJ, t.GXR, t.ZT, t.WD1, t.JD1, t.LKWFLX, t.BQ, t.QXSBBM FROM XX t WHERE t.zt = 1 AND t.zdlk = ? ORDER BY t.cjsj DESC ) where rownum <= ?
### Cause: java.lang.reflect.UndeclaredThrowableException
严重: Servlet.service() for servlet [spring] in context with path [/NdManagent] 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.reflect.UndeclaredThrowableException
### The error may exist in file [E:\Work_QYF\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\NdManagent\WEB-INF\classes\com\lst\mapping\XXMapper2.xml]
### The error may involve com.lst.dao.XXMapper2.queryListByMap-Inline
### The error occurred while setting parameters
### SQL: select * from ( SELECT t.LKH, t.LKMC, t.CJJG, t.QXDM, t.ZDYFZ, (CASE t.ZDLK WHEN 1 THEN '是' WHEN 0 THEN '否'END) AS zdlk, t.LX, t.XCXS, t.DLZL, t.DLLX, t.LKZT, t.CDS, t.JD, t.WD, t.QZ, t.KZZD1, t.KZZD2, t.WFDD, t.LDDM, t.LDMC, t.DDMS, t.XH, t.JSRQ, t.CJDW, t.TZDW, t.XSFX, t.WFDD1, t.LDDM1, t.DDMS1, t.LKMC1, t.FLG, t.QYZT, t.LK_YJ_FLG, t.LK_YJZ, t.LK_YJ_MIN, t.LK_YJ_MAX, t.LKSHZT, t.BZ, t.CJSJ, t.CJR, t.GXSJ, t.GXR, t.ZT, t.WD1, t.JD1, t.LKWFLX, t.BQ, t.QXSBBM FROM XX t WHERE t.zt = 1 AND t.zdlk = ? ORDER BY t.cjsj DESC ) where rownum <= ?
### Cause: java.lang.reflect.UndeclaredThrowableException] with root cause
java.sql.SQLException: 无法转换为内部表示
分析:
获取的记录数,是正确的,且,访问数据库之前未报错,说明:MyBatis已经访问过了Oracle了且SQL语句(含条件判断)没有错。
我检查XxxController对应方法、XxxService对应方法、XxxMapper.java对应方法及其参数、XxxVo的属性名称是否对得上XxxMapper.xml对应SQL语句的字段名,且属性有没有setter和getter【就是偏偏没对XxxVo属性的类型!!!】,都是没有问题的!!!但很明显:
获取的SQL记录无处安放!!!就是与<select>的returnType有关呀!!!
改:
然后发现XxVo的zdlk的属性类型为Short,虽然在Oracle中数据表的zdlk为NUMBER(2)类型,但我的SQL语句中,返回的zdlk值:要么为“是”要么为“否”,则改zdlk属性类型改为String,就完事了~
大意了!!!
从该问题看出: