`

ibatis The error happened while setting a property on the result object

阅读更多
问题:
在使用Ibatis查询数据返回时,报如下错误:
[com.show.add.proxy.SqlMapClientTemplateProxy]com.ibatis.common.jdbc.exception.NestedSQLException:   
		--- The error occurred in com/show/add/ibatis/adChannel.xml.  
		--- The error occurred while applying a result map.  
		--- Check the queryRomStatisticsInfoCount-AutoResultMap.  
		--- The error happened while setting a property on the result object.  
		--- Cause: java.lang.RuntimeException: Error setting property 'setCritical_value' of 'com.show.add.domain.RomAdResult@11d2625d'.  Cause: java.lang.IllegalArgumentException
			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 com.show.add.proxy.SqlMapClientTemplateProxy$2.doInSqlMapClient(SqlMapClientTemplateProxy.java:344)
			at com.show.add.proxy.SqlMapClientTemplateProxy.execute(SqlMapClientTemplateProxy.java:229)
			at com.show.add.proxy.SqlMapClientTemplateProxy.queryForObject(SqlMapClientTemplateProxy.java:342)
			at com.show.add.dao.AdChannelDeductionDao.queryRomStatisticsInfoCount(AdChannelDeductionDao.java:165)
			at com.show.add.service.impl.AdChannelDeductionServiceImpl.queryRomStatisticsInfoCount(AdChannelDeductionServiceImpl.java:73)
			at com.show.add.action.GetRomUserDataAction.serach(GetRomUserDataAction.java:165)
			at com.show.add.action.GetRomUserDataAction.setParameters(GetRomUserDataAction.java:144)
			at com.show.add.action.GetRomUserDataAction.login(GetRomUserDataAction.java:83)
			at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
			at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
			at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
			at java.lang.reflect.Method.invoke(Method.java:597)
			at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
			at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
			at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
			at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
			at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
			at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
			at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
			at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
			at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
			at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
			at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
			at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
			at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
			at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
			at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
			at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
			at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
			at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
			at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
			at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
			at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
			at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
			at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
			at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
			at java.lang.Thread.run(Thread.java:662)
		Caused by: java.lang.RuntimeException: Error setting property 'setCritical_value' of 'com.show.add.domain.RomAdResult@11d2625d'.  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)
			... 76 more
		Caused by: java.lang.IllegalArgumentException
			at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
			at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
			at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
			at java.lang.reflect.Method.invoke(Method.java:597)
			at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:46)
			... 84 more



原因:
返回数据类型与设置对象属性不匹配,如:当属性类型为数值型,而返回数据为空,也会报此类异常,本处也是类似异常


解决方案:
把对象属性由INT类型修改为Integer类型
分享到:
评论

相关推荐

    为 Ibatis 2.3.4 构建增强的 Apache Ibator 实体类生成工具

    Ibator seeks to make a major impact on the large percentage of database operations that are simple CRUD (Create, Retrieve, Update, Delete). You will still need to hand code SQL and objects for custom...

    Spring高版本对ibatis的支持

    最近想在最新的Spring5.0中集成ibatis(不是mybatis),发现已经不在支持SqlmapClientTemplate和SqlmapClientFactoryBean,于是搞了这个工具jar来进行支持如下配置 ...

    ibatis生成xml,object

    Ibatis 是一款轻量级的Java持久层框架,它提供了SQL映射功能,将SQL语句与Java代码分离,使得数据库访问更为灵活。在传统的Java开发中,我们需要手动编写SQL语句并将其硬编码到DAO层的Java类中,这不仅增加了代码...

    ibatis总结 ibatis ibatis ibatis ibatis

    Ibatis 是一款轻量级的Java持久层框架,它允许开发者将SQL语句与Java代码分离,从而使得数据库访问更加灵活、易于维护。本篇文章将深入探讨Ibatis的核心概念、最佳实践以及与其他框架如Struts和Spring的整合。 1. ...

    IBatis常用操作封装

    本篇我们将深入探讨“IBatis常用操作封装”,并结合提供的`IBatisDao.java`文件来解析其核心功能和用法。 首先,`IBatis`的核心理念是通过XML或注解的方式定义SQL映射文件,将SQL语句与业务逻辑代码分离,提高了...

    ibatis中iterate的例子

    在Java Web开发中,iBatis(现在称为MyBatis)是一个流行的持久层框架,它提供了灵活的SQL映射机制,使得数据库操作更加便捷。在iBatis中,`<iterate>`标签是一个非常实用的功能,它允许我们处理集合数据,如数组、...

    Ibatis3手册 Ibatis3参考手册

    ### Ibatis3手册知识点概述 Ibatis3作为一款流行的持久层框架,在软件开发领域具有重要的地位。本篇文章基于“Ibatis3手册 Ibatis3参考手册”的标题及描述,深入解析Ibatis3的核心概念、架构特点以及如何进行实际...

    ibatis源码,ibatis源码 ibatis源码 ibatis源码

    iBatis,一个优秀的Java持久层框架,以其轻量级、灵活的特性在众多ORM(Object-Relational Mapping)框架中独树一帜。iBatis的核心在于它的SQL映射机制,它将数据库操作与业务逻辑解耦,使得开发者可以自由地编写SQL...

    ibatis demo,ibatis例子,ibatis示例

    Ibatis,全称为MyBatis,是一个优秀的Java持久层框架,它主要负责SQL映射,使得开发者能够将SQL语句与Java代码分离,从而更好地管理数据库操作。Ibatis的出现,解决了传统JDBC中手动编写SQL和结果集映射的繁琐工作,...

    Spring+ibatis 保留ibatis事务的配置

    根据提供的文件信息,本文将详细解析如何在Spring与ibatis框架整合时,通过特定配置来保留ibatis事务处理机制,并实现对事务的自定义控制。文章将围绕标题、描述及部分代码片段展开讨论。 ### Spring与ibatis整合...

    SPRING IBATIS 保留IBATIS事务的配置方式

    根据提供的文件信息,本文将详细解析Spring与iBatis整合时如何保留并使用iBatis事务管理机制,以及如何在应用程序中实现手动控制事务的方法。 ### Spring与iBatis整合 Spring框架是一个全面的企业级应用开发框架,...

    iBatis文档\ibatis.doc

    iBatis 是一款轻量级的Java持久层框架,它主要负责将数据库操作与业务逻辑解耦,使得开发者可以更加专注于SQL和业务代码的编写。本文档将详细讲解iBatis的核心概念、快速入门以及高级特性。 ### iBatis 快速启动 #...

    ibatis应对批量update

    ### ibatis应对批量update 在处理大量数据更新时,传统的for循环方式往往会导致效率低下。这是因为每一次循环都需要执行一次数据库连接操作,对于批量更新来说,这样的处理方式显然不够高效。为了解决这个问题,...

    myBatis和ibatis的区别

    ### myBatis与ibatis的区别 #### 一、概述 myBatis与ibatis是两款在Java领域中非常流行的持久层框架,它们均基于SQL映射机制,为开发者提供了便捷的方式来处理数据库操作。两者间的关系密切,ibatis是myBatis的...

    ibatis 一个简单的项目详解

    ### ibatis 一个简单的项目详解 #### 一、概述 本文档旨在通过一个简单的示例项目,帮助初学者快速理解并掌握ibatis(现称MyBatis)的基本使用方法及其与Struts2和Spring框架集成的方式。ibatis是一个支持普通SQL...

    Ibatis入门例子,Ibatis教程

    Ibatis,全称为MyBatis,是一个优秀的Java持久层框架,它主要负责SQL映射,使得开发者能够将注意力集中在编写SQL语句上,而无需关注JDBC代码的编写。Ibatis消除了几乎所有的JDBC代码和手动设置参数以及获取结果集的...

    ibatis与spring整合

    ### ibatis与Spring框架整合详解 #### 一、ibatis简介 ibatis是一个开源的、基于Java的持久层框架,它提供了SQL映射的方式来进行数据库访问。与Hibernate等其他ORM框架相比,ibatis更加轻量级,对于那些只需要简单...

    iBatis简明教程及快速入门

    iBatis是一个开源框架,用于实现Java应用程序中的对象关系映射(Object Relational Mapping, ORM)。相较于其他ORM框架如Hibernate,iBatis更加轻量级且易于上手。iBatis的核心优势在于其灵活性和简洁性,特别适合于...

    ibatis入门与ibatis迭代的用法

    **ibatis入门** iBatis,一款轻量级的Java持久层框架,是MyBatis的前身,由美国华人开发团队开发。它提供了一个SQL、Java和XML的映射框架,将SQL语句与Java代码分离,使得开发者可以更加灵活地处理数据库操作,避免...

Global site tag (gtag.js) - Google Analytics