ibatis resultMap报错解决一例

开发 后端
我们经常遇到ibatis resultMap报错的情况,由于ibatis resultMap报错的情况有多种,我们今天就拿出来一种ibatis resultMap报错的解决方法,希望对您的工作有所帮助。

ibatis resultMap报错信息:

SQLErrorCodesFactory - Database product name cached for DataSource [org.apache.commons.dbcp.BasicDataSource@19c5048]: name is 'MySQL'
SQLErrorCodesFactory - SQL error codes for 'MySQL' found
SQLErrorCodeSQLExceptionTranslator - Unable to translate SQLException with Error code '0', will now try the fallback translator
DataSourceUtils - Returning JDBC Connection to DataSource
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in net/jbbs/dao/ibatis/map/user.xml.
--- The error occurred while applying a result map.
--- Check the user.userResult.
--- The error happened while setting a property on the result object.
--- Cause: net.sf.cglib.beans.BulkBeanException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in net/jbbs/dao/ibatis/map/user.xml.
--- The error occurred while applying a result map.
--- Check the user.userResult.
--- The error happened while setting a property on the result object.
--- Cause: net.sf.cglib.beans.BulkBeanException
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in net/jbbs/dao/ibatis/map/user.xml.
--- The error occurred while applying a result map.
--- Check the user.userResult.
--- The error happened while setting a property on the result object.
--- Cause: net.sf.cglib.beans.BulkBeanException
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:243)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:241)
at net.jbbs.dao.ibatis.UserDAOImpl.findByEmail(UserDAOImpl.java:54)
at net.jbbs.test.UserTest.findByEmail(UserTest.java:42)
at net.jbbs.test.UserTest.main(UserTest.java:34)
Caused by: net.sf.cglib.beans.BulkBeanException
at net.jbbs.domain.User$$BulkBeanByCGLIB$$88b6b34d.setPropertyValues()
at com.ibatis.sqlmap.engine.accessplan.EnhancedPropertyAccessPlan.setProperties(EnhancedPropertyAccessPlan.java:33)
at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java:112)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 10 more

这个ibatis resultMap错误信息指出resultMap里有问题。说错误发生在设置某一个属性的时候,但是没有具体说明是一个怎么样的错误。由于对于ibatis了解还不是很深,所以一时不知如何事好。只有在ibatis resultMap里面作文章,把里面的注释掉一些,哈哈,程序居然正常跑起来了。看来我快要找到错误了,接着继续排除其它的,终于让我找到出错的一行了: 
 
 
 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/liguohuaty/archive/2009/03/31/4038437.aspx

【编辑推荐】

  1. 了解iBatis.Net中的ResultMap
  2. ibatis resultMap groupBy属性巧使用
  3. ibatis标签详解
  4. ibatis下加入c3p0连接池的方法
  5. ibatis也能用proxool连接池
责任编辑:桑丘 来源: liguohuaty的专栏
相关推荐

2009-07-22 10:03:11

iBATIS Resu

2009-07-16 13:30:12

resultMapgroupBy属性

2009-09-17 16:38:02

WSUS服务器

2009-07-16 13:50:31

ibatisResultMap

2012-05-17 09:26:43

MapReduce

2012-09-24 01:01:49

NginxNginx性能Web服务器

2009-12-01 09:15:30

Windows 7系统激活

2014-11-19 09:22:48

云计算Dockerpython API

2009-08-07 09:57:38

2013-11-12 14:43:43

MySQL数据库

2017-01-16 15:43:54

存储虚拟化控制器

2021-03-08 06:29:53

微信僵尸粉移动应用

2013-10-15 09:48:03

C++Lambda函数式编程

2021-07-06 12:07:27

Go 服务性能

2009-07-15 09:30:00

ibatis级联

2009-08-06 11:37:24

虚拟机NAT连接物理网络

2020-11-10 13:42:07

Go编译器修复

2022-12-26 09:05:35

2009-07-21 09:55:45

iBATIS分页

2009-07-21 17:31:39

iBATIS一对多映射
点赞
收藏

51CTO技术栈公众号