com.ibatis.common.jdbc.exception.NestedSQLException:Error setting property...
2012-11-21 00:43
393 查看
今天一直配Ibatis的时候一直报这个错误,用的是Oracle数据库。
找了很多帮助,有说连接池问题的,重启服务后仍不能解决。后来再网上查完后才恍然大悟,原来我的测试数据中int类型的列是null,当查询转换时,不能把null转换成int类型,导致产生异常。
解决方法:
1.填充数据库里的列类型为int的列的数据(有点治标不治本)。
2.加入isnull判断
com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in User.xml. --- The error occurred while applying a result map. --- Check the selectAllUser-AutoResultMap. --- The error happened while setting a property on the result object. --- Cause: java.lang.RuntimeException: Error setting property 'setAge' of 'com.ibatis.model.UserInfo@78a212'. Cause: java.lang.IllegalArgumentException at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:122) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:99) at com.ibatis.dao.UserDao.findAll(UserDao.java:51) at com.ibatis.dao.UserDao.main(UserDao.java:66) Caused by: java.lang.RuntimeException: Error setting property 'setAge' of 'com.ibatis.model.UserInfo@78a212'. Cause: java.lang.IllegalArgumentException at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52) 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) ... 8 more Caused by: java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:46) ... 16 more Exception in thread "main" java.lang.NullPointerException at com.ibatis.dao.UserDao.main(UserDao.java:66)
找了很多帮助,有说连接池问题的,重启服务后仍不能解决。后来再网上查完后才恍然大悟,原来我的测试数据中int类型的列是null,当查询转换时,不能把null转换成int类型,导致产生异常。
解决方法:
1.填充数据库里的列类型为int的列的数据(有点治标不治本)。
2.加入isnull判断
相关文章推荐
- com.ibatis.common.jdbc.exception.NestedSQLException:原因分析
- Ibatis com.ibatis.common.jdbc.exception.NestedSQLException
- com.ibatis.common.jdbc.exception.NestedSQLException 今天用ibatis做数据查询时发生了这个异常
- Cause: net.sf.cglib.beans.BulkBeanException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
- com.ibatis.common.jdbc.exception.NestedSQLException:
- ibatis+spring+mysql nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
- 将截断字符串或二进制数据。; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
- iBatis2错误:com.ibatis.common.jdbc.exception.NestedSQLException:
- iBatis2错误:com.ibatis.common.jdbc.exception.NestedSQLException:
- 问题:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Dri
- Ibaitis Caused by: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean.
- SpringMVC:com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax;
- Java与mysql数据库编程中遇见“Before start of result set at com.mysql.jdbc.SQLError.createSQLException” 的解决办法
- ibatis Cause: com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误
- nested exception is org.apache.ibatis.builder.BuilderException Error invoking SqlProvider method
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'baiduIndex' in class '
- com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax;
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'value' in class 'com.ving.xzfw.vo.PaymentInfo'
- org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'value' in class 'com.ving.xzfw.vo.PaymentInfo'