title: MyBatis Springs Oracle Stored Procedure
body: <p>I have been working on Spring application where I am working with MyBatis:</p>
  
  <p>Consider I am having a Oracle Stored Procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE getDBUSERByUserId(
       p_userid IN DBUSER.USER_ID INTEGER,
       o_username OUT DBUSER.USERNAME VARCHAR,
       o_createdby OUT  DBUSER.CREATED_BY VARCHAR, 
       o_date OUT DBUSER.CREATED_DATE DATE)
  IS 
  BEGIN
     SELECT USERNAME , CREATED_BY, CREATED_DATE
     INTO o_username, o_createdby,  o_date
     from  DBUSER WHERE USER_ID = p_userid;
  END
  </code></pre>
  
  <p>For the above SP I have written the following mapper.xml:</p>
  
  <pre><code>&lt;mapper namespace="UserDetails"&gt;
    &lt;resultMap id="getDbUserDetails" type="map"&gt;
      &lt;result property="p_userid" column="INTEGER" /&gt;
      &lt;result property="o_username" column="VARCHAR" /&gt;
      &lt;result property="o_createdby" column="VARCHAR" /&gt;
      &lt;result property="o_date" column="VARCHAR" /&gt;
    &lt;/resultMap&gt;
  
    &lt;select id="getDbUserByUserId" resultMap="getDbUserDetails" parameterType="map" statementType="CALLABLE"&gt;
          { call getDBUSERByUserId(
             #{p_userid,jdbcType=INTEGER,mode=IN},
             #{o_username,jdbcType=VARCHAR,mode=OUT},
             #{o_createdby,jdbcType=VARCHAR,mode=OUT},
             #{o_date,jdbcType=VARCHAR,mode=OUT})
           }
    &lt;/select&gt;
  &lt;/mapper&gt;
  </code></pre>
  
  <p>The corresponding Java Code for calling this SP:</p>
  
  <pre><code>public Map&lt;String, Object&gt; getUserDetails() {
  
    Map&lt;String, Object&gt; parametersMap = new HashMap&lt;String, Object&gt;();
    parametersMap.put(p_userid,"XYZ-123");
    parametersMap.put(o_username,"Tom74");
    parametersMap.put(o_createdby,"Maverick");
    parametersMap.put(o_date,new Date());
  
    getSqlSession().selectList("UserDetails.getDbUserByUserId", parametersMap);
  
    System.out.println(parametersMap);
  
    return parametersMap;
  }
  </code></pre>
  
  <p>At the time of execution it is throwing an exception:</p>
  
  <pre><code>org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.String
      at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
      at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
      at com.sun.proxy.$Proxy7.selectList(Unknown Source)
      at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:194)
      at com.bt.cmps.kci_services.dao.NotificationDaoImplV10.getKcis(NotificationDaoImplV10.java:252)
      at com.bt.kci_services.services.NotificationServiceImplV10.getKcis(NotificationServiceImplV10.java:208)
      at com.bt.kci_services.services.NotificationProcessorImplV10.getKcis(NotificationProcessorImplV10.java:106)
      at com.bt.kci_services.services.test.NotificationProcessorImplV10Test.testGetKcisForOnlyCustId(NotificationProcessorImplV10Test.java:103)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runManaged(AbstractJUnit38SpringContextTests.java:334)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.access$0(AbstractJUnit38SpringContextTests.java:326)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests$1.run(AbstractJUnit38SpringContextTests.java:216)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runTest(AbstractJUnit38SpringContextTests.java:296)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runTestTimed(AbstractJUnit38SpringContextTests.java:253)
      at org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runBare(AbstractJUnit38SpringContextTests.java:213)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  Caused by: org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.String
      at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:373)
      at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:311)
      at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
      at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:698)
      at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:629)
      at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:624)
      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:103)
      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
  Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.lang.String
      at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:791)
      at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:550)
      at org.apache.ibatis.builder.MapperBuilderAssistant.setStatementResultMap(MapperBuilderAssistant.java:371)
  </code></pre>
  
  <p>I googled a lot about this issues but nothing seems to help.
  I am new with MyBatis so any help would be highly appreciated.
  I am using mybatis-3.2.3.</p>
  
  <p>Thanks in advance..!!!</p>