title: There was no TypeHandler found for parameter * of statement + java.lang.ClassCastException: java.util.ArrayList incompatible with [Ljava.lang.Object;
body: <p>The stored proc spec :</p>
  
  <pre><code>TYPE RESOURCELIST IS TABLE OF VARCHAR2(7);
  PROCEDURE save_prvdr_scope_group_xref
  (
      p_region_id                IN    bg_prvdr_scope_group_xref.region_id%TYPE,
      p_revision_id              IN    bg_prvdr_scope_group_xref.revision_id%TYPE,
      p_bg_revision_id           IN    bg_prvdr_scope_group_xref.bg_revision_id%TYPE,
      p_classification_id        IN    bg_prvdr_scope_group_xref.classification_id%TYPE,
      p_facility_id              IN    bg_prvdr_scope_group_xref.facility_id%TYPE,
      p_provider_group_id        IN    bg_prvdr_scope_group_xref.provider_group_id%TYPE,
      p_resourceList             IN    RESOURCELIST,
      p_user_id                  IN    bg_prvdr_scope_group_xref.create_user_id%TYPE,
      p_ora_rowscn               IN    NUMBER,
      p_cur_out                  OUT   g_cursor
  
  );
  </code></pre>
  
  <p>Mybatis mapping looks like: </p>
  
  <pre><code>&lt;mapper namespace="BookingGuidelineProviderScopeXRef"&gt;
  
  &lt;parameterMap id="updateProviderScopeGroupXRefParameters" type="java.util.Map" &gt;
      &lt;parameter property="REGIONID" jdbcType="INTEGER" javaType="int" mode="IN"/&gt;
      &lt;parameter property="REVISIONID" jdbcType="INTEGER" javaType="int" mode="IN"/&gt;
      &lt;parameter property="BGREVISIONID" jdbcType="INTEGER" javaType="int" mode="IN"/&gt;
      &lt;parameter property="CLASSIFICATIONID" jdbcType="INTEGER" javaType="int" mode="IN"/&gt;
      &lt;parameter property="FACILITY" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN"/&gt;
      &lt;parameter property="PROVIDER_GROUP_ID" jdbcType="INTEGER" javaType="int" mode="IN"/&gt;
      &lt;parameter property="RESOURCES" jdbcType="ARRAY"  javaType="java.util.List" mode="IN"/&gt;
      &lt;parameter property="USERID" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN" /&gt;
      &lt;parameter property="ORAROWSCN" jdbcType="BIGINT" javaType="long" mode="IN" /&gt;      
      &lt;parameter property="cur_out" jdbcType="CURSOR" javaType="java.sql.ResultSet" mode="OUT" resultMap="BookingGuidelinesErrorMapping.ErrorMapBookingGuidelines" /&gt;
  
  &lt;/parameterMap&gt;
  
  &lt;insert id="updateProviderScopeGroupXRef" parameterMap="updateProviderScopeGroupXRefParameters" statementType="CALLABLE"&gt;
      {call PKG_BG_PRVDR_SCOPE_GROUP_XREF.save_prvdr_scope_group_xref (?,?,?,?,?,?,?,?,?,?)}
  &lt;/insert&gt;   
  &lt;/mapper&gt;
  </code></pre>
  
  <p>Exception :</p>
  
  <p>org.apache.ibatis.exceptions.PersistenceException: 
     ### Error querying database.  Cause:       org.apache.ibatis.executor.ExecutorException:<br>
      There was no TypeHandler found for parameter RESOURCES of statement    BookingGuidelineProviderScopeXRef.updateProviderScopeGroupXRef
     ### The error may involve    BookingGuidelineProviderScopeXRef.updateProviderScopeGroupXRefParameters
     ### The error occurred while setting parameters
     ### Cause: org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found    for parameter RESOURCES of statement          BookingGuidelineProviderScopeXRef.updateProviderScopeGroupXRef</p>
  
  <p>I m very new to mybatis.
  Any link or example that help understand TypeHandler and its mapping and implementation will be highly appreciated.</p>
  
  <p>Basically looking for a solution to pass array of string from mybatis to oracle stored procedure. </p>
  
  <p>I also tried adding following :</p>
  
  <pre><code>public class ArrayTypeHandler implements TypeHandler&lt;Object&gt; {
  
  public Object getResult(ResultSet resultSet, String columnName) throws SQLException {
      return resultSet.getObject(columnName);
  }
  
  public Object getResult(CallableStatement statement, int i)
          throws SQLException {
      return statement.getArray(i).getArray();
  
  }
  
  public void setParameter(PreparedStatement ps, int i, Object param,
          JdbcType jdbctype) throws SQLException {
      if (param == null) {
          ps.setNull(i, Types.ARRAY);
      } else {
          Connection conn = ps.getConnection();
          Array loc = conn.createArrayOf("RESOURCELIST", (Object[]) param);
          ps.setArray(i, loc);
      }
  
  }
  
  }
  </code></pre>
  
  <p>org.apache.ibatis.exceptions.PersistenceException: </p>
  
  <h3>Error querying database.  Cause: java.lang.ClassCastException: java.util.ArrayList incompatible with [Ljava.lang.Object;</h3>
  
  <h3>The error may involve BookingGuidelineProviderScopeXRef.updateProviderScopeGroupXRefParameters</h3>
  
  <h3>The error occurred while setting parameters</h3>
  
  <h3>Cause: java.lang.ClassCastException: java.util.ArrayList incompatible with [Ljava.lang.Object;</h3>
  
  <pre><code>at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:81)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:73)
  at org.kp.cccs.sysadmin.booking.dao.BookingGuidelineProviderScopeGroupXRefBuilder.updateProviderScopeGroupXRef(BookingGuidelineProviderScopeGroupXRefBuilder.java:62)
  at org.kp.cccs.sysadmin.booking.junit.TestProviderScopeGroupBuilderXRef.testUpdateProviderScopeGroupXRef(TestProviderScopeGroupBuilderXRef.java:62)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  at java.lang.reflect.Method.invoke(Method.java:611)
  at junit.framework.TestCase.runTest(TestCase.java:168)
  at junit.framework.TestCase.runBare(TestCase.java:134)
  at junit.framework.TestResult$1.protect(TestResult.java:110)
  at junit.framework.TestResult.runProtected(TestResult.java:128)
  at junit.framework.TestResult.run(TestResult.java:113)
  at junit.framework.TestCase.run(TestCase.java:124)
  at junit.framework.TestSuite.runTest(TestSuite.java:243)
  at junit.framework.TestSuite.run(TestSuite.java:238)
  at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  </code></pre>
  
  <p>Caused by: java.lang.ClassCastException: java.util.ArrayList incompatible with [Ljava.lang.Object;
      at org.kp.cccs.sysadmin.booking.model.dto.util.ArrayTypeHandler.setParameter(ArrayTypeHandler.java:39)
      at org.apache.ibatis.executor.parameter.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:73)
      at org.apache.ibatis.executor.statement.CallableStatementHandler.parameterize(CallableStatementHandler.java:64)
      at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:43)
      at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:56)
      at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:40)
      at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:243)
      at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:117)
      at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
      at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:79)
      ... 22 more
  Thanks,</p>