Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-745

Unable to access oracle ref cursor as OUT parameter

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0 Beta 9
    • Fix Version/s: 3.0 Beta 10
    • Component/s: Core
    • Environment:
      Windows , Oracle 11.0 g, Tomcat

      Description

      Hi,

      I am trying to execute a stored procedure from my web application using Ibatis 3.0 Beta 9 version.
      Following is snippet from mapper.xml file:

      <resultMap id="userDataResultMap" type="TestUserData">
      <id property="userid" column="userid" />
      <result property="firstName" column="firstName"/>
      <result property="lastName" column="lastName"/>
      <result property="zip" column="zip"/>
      <result property="summary" column="summary"/>
      <result property="specialities" column="specialities"/>
      <result property="isActive" column="isActive"/>
      <result property="country" column="country"/>
      <result property="platform" column="platforms"/>
      </resultMap>

      <select id="getFullPublicData" statementType="CALLABLE" parameterType="User" >
      {call p_user_public_data(#

      {userId}

      ,#

      {userData,mode=OUT,jdbcType=CURSOR,javaType=TestUserData,resultMap=userDataResultMap}

      ,#

      {noOfConnections,mode=OUT,jdbcType=NUMERIC,javaType=int}

      ,#

      {noOfRecommendations,mode=OUT,jdbcType=NUMERIC,javaType=int}

      )}
      </select>

      The stored procedure is getting executed, but I am getting following error message while I execute using Ibatis, It seems there is some issue with OUT parameter which has a Oracle ref cursor as jdbc type.

      org.apache.ibatis.exceptions.IbatisException:

          1. Error querying database. Cause: java.lang.NullPointerException
          2. The error may involve com.test.data.UserPublicViewMapper.getFullPublicData-Inline
          3. The error occurred while setting parameters
          4. Cause: java.lang.NullPointerException
            org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
            org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:61)
            org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:53)
            org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:38)
            org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:66)
            org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
            $Proxy6.getFullPublicData(Unknown Source)
            com.test.service.UserPublicViewDO.getUserPublicData(UserPublicViewDO.java:29)
            com.test.action.UserPublicDataAction.execute(UserPublicDataAction.java:18)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            java.lang.reflect.Method.invoke(Unknown Source)
            com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
            com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
            com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
            com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
            org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
            com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
            com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
            com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
            com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
            com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
            org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
            org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
            org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

      root cause

      java.lang.NullPointerException
      org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:64)
      org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:43)
      org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
      org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41)
      org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:90)
      org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:68)
      org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:59)
      org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:53)
      org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:38)
      org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:66)
      org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
      $Proxy6.getFullPublicData(Unknown Source)
      com.test.service.UserPublicViewDO.getUserPublicData(UserPublicViewDO.java:29)
      com.test.action.UserPublicDataAction.execute(UserPublicDataAction.java:18)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
      com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
      com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
      org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
      org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
      org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

      Any suggestion would be helpful as it has become a show stopper in my project.

      Thanks,
      Arpana

        Attachments

          Activity

            People

            • Assignee:
              cbegin Clinton Begin
              Reporter:
              arpanabansal new user
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: