title: Mybatis and invalid types
body: <p>I use mybatis 3.2.2,  PostgreSQL and get the "Error instantiating class xxx with invalid types or values". The exception is triggered when calling <strong>getPluginId()</strong>. Here is my configuration:</p>
  
  <p>mapper.xml:</p>
  
  <pre><code>&lt;resultMap type="my.class.plugins.Plugin" id="pluginMap"&gt;
      &lt;constructor&gt;
          &lt;idArg column="id" javaType="_int"/&gt;
          &lt;arg column="dtype" javaType="String"/&gt;
      &lt;/constructor&gt;
  
  &lt;/resultMap&gt;
  </code></pre>
  
  <p>and this a problematic method:</p>
  
  <pre><code>&lt;select id="getPluginById" resultMap="pluginMap"&gt;
  SELECT *
  FROM public.plugin
  WHERE id = #{id, jdbcType=NUMERIC}
  &lt;/select&gt;   
  </code></pre>
  
  <p>a default constructor:</p>
  
  <pre><code>public abstract class Plugin {
  ...
  public Plugin(int id, String name) {
      this.id = id;
      this.name = name;
  }
  }
  </code></pre>
  
  <p>an the exception:</p>
  
  <pre><code>org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating class my.class.plugins.Plugin with invalid types (int,String,) or values (7418,FORWARD,). Cause: java.lang.InstantiationException
  at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
  at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
  at $Proxy15.selectOne(Unknown Source)
  at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159)
  at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
  at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
  at $Proxy16.getPluginById(Unknown Source)
  at my.class.service.UserServiceImpl.getUserById(UserServiceImpl.java:44)
  at my.class.persistence.db.DbUserDaoTest.testLoading(DbUserDaoTest.java:74)
  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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
  at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
  at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
  at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
  at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  
  Caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating class my.class.plugins.Plugin with invalid types (int,String,) or values (7418,FORWARD,). Cause: java.lang.InstantiationException
  at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:83)
  at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:45)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.createParameterizedResultObject(FastResultSetHandler.java:415)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.createResultObject(FastResultSetHandler.java:384)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.createResultObject(FastResultSetHandler.java:365)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.getRowValue(FastResultSetHandler.java:261)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleRowValues(FastResultSetHandler.java:216)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSet(FastResultSetHandler.java:188)
  at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:154)
  at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57)
  at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)
  at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)
  at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)
  at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)
  at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:115)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)
  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 org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
  ... 37 more
   Caused by: java.lang.InstantiationException
  at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
  at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:67)
  ... 59 more
  </code></pre>