ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: The error occurred while applying a parameter map.
Date Wed, 20 Aug 2008 15:43:24 GMT
deptNum and year must be properties of a single parameter object (or a
Map).  The method you are calling passes NO parameter objects to iBATIS -
arg1 and arg2 in this case are skip and max parameters for paging support.

Also, you don't need to specify both column and columnIndex in your result
mappings.  If you specify both the columnIndex will be,
essentially, ignored.

Jeff Butler

On Wed, Aug 20, 2008 at 10:29 AM, macdoug1 <macdoug1@swbell.net> wrote:

>
> I'm using Spring framework with iBatis and I'm having an issue with using
> the
> sqlMapClient.queryForList(String arg, int arg1, int arg2). Anyway the
> Transfer Object is deptNum and year are defined as String's. Also the table
> defines dept_num and year as varchars.  Here's the resultMap:
> <resultMap id="result" class="com.talisen.domain.DeptBsDetail">
>    <result property="deptNum" column="dept_num" columnIndex="1"/>
>    <result property="year" column="year" columnIndex="2"/>
>    <result property="monthDate" column="month_date" columnIndex="3"/>
>    <result property="wopm1" column="wopm1" columnIndex="4"/>
>    <result property="wonum" column="wonum" columnIndex="5"/>
>    <result property="usageCost" column="usage_cost" columnIndex="6"/>
>    <result property="materialCost" column="material_cost" columnIndex="7"/>
>    <result property="laborCost" column="labor_cost" columnIndex="8"/>
>    <result property="serviceCost" column="serv_cost" columnIndex="9"/>
>    <result property="totalCost" column="total_cost" columnIndex="10"/>
>    <result property="wopm4" column="wopm4" columnIndex="11"/>
>    <result property="description" column="description" columnIndex="12"/>
>    <result property="ledgerCode" column="ledger_code" columnIndex="13"/>
>    <result property="yearmonth" column="yearmonth" columnIndex="14"/>
>  </resultMap>
>
>  <select id="getDeptBudgetDetailbyDeptNumAndYear" resultMap="result">
>    select
>          dept_bs_detail_yymm.dept_num,
>          dept_bs_detail_yymm.year,
>          dept_bs_detail_yymm.month_date,
>          dept_bs_detail_yymm.wopm1,
>          dept_bs_detail_yymm.wonum,
>          dept_bs_detail_yymm.usage_cost,
>          dept_bs_detail_yymm.material_cost,
>          dept_bs_detail_yymm.labor_cost,
>          dept_bs_detail_yymm.serv_cost,
>          dept_bs_detail_yymm.total_cost,
>          dept_bs_detail_yymm.wopm4,
>          dept_bs_detail_yymm.description,
>          dept_bs_detail_yymm.ledger_code,
>          dept_bs_detail_yymm.yearmonth
>    from dept_bs_detail_yymm
>    where dept_bs_detail_yymm.dept_num = #deptNum#
>    and dept_bs_detail_yymm.year = #year#
>  </select>
>
> Here's the full error I'm getting:
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in com/talisen/dao/ibatis/maps/DeptBsDetail.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getDeptBudgetDetailbyDeptNumAndYear-InlineParameterMap.
> --- Check the parameter mapping for the 'year' property.
> --- Cause: java.lang.ArrayIndexOutOfBoundsException: 1
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:204)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:126)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:130)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:106)
>        at
>
> com.talisen.dao.ibatis.SqlMapDeptBsDetailDao.getDeptBudgetDetail(SqlMapDeptBsDetailDao.java:37)
>        at
>
> com.talisen.domain.logic.NestleDataFetcherImpl.getDeptBudgetDetail(NestleDataFetcherImpl.java:58)
>        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:585)
>        at
>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>        at
>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>        at
>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>        at
>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>        at $Proxy16.getDeptBudgetDetail(Unknown Source)
>        at
> com.talisen.domain.util.XMLBuilder.createDepartmentXML(XMLBuilder.java:254)
>        at com.talisen.domain.util.XMLBuilder.createXML(XMLBuilder.java:223)
>        at
>
> com.talisen.service.NestleService.handleRequestInternal(NestleService.java:143)
>        at
>
> org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
>        at
>
> org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
>        at
>
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
>        at
>
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
>        at
>
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
>        at
>
> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>        at
>
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>        at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
>        at
>
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
>        at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>        at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>        at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>        at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>        at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>        at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>        at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>        at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>        at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
>        at
>
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
>        at
>
> com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
>        at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
>        at
>
> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>        at
>
> com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameter(ParameterMap.java:153)
>        at
>
> com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameters(ParameterMap.java:126)
>        at
>
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:183)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
>
> Does anyone have any idea? I thought about using the sqlMapClientTemplate
> that spring provides but queryForList method in that case doesn't have
> anything where I can pass two parms to it, where I can get a list back.
>
>
> --
> View this message in context:
> http://www.nabble.com/The-error-occurred-while-applying-a-parameter-map.-tp19070022p19070022.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message