Hello!
Given the SQL mapping sample:
WHERE cl.user_id = #{value, javaType=java.util.UUID, jdbcType=BINARY, typeHandler=dao.UUIDTypeHandler}
it complains that "There is no getter for property named 'value' in 'class java.util.UUID'"
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'value' in 'class java.util.UUID'
at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:377)
at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:167)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:149)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:45)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:113)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:72)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:77)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:58)
at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:76)
at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:53)
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.select(DefaultSqlSession.java:124)
So tracing back to
mybatis-3.2.2-sources.jar!/org/apache/ibatis/scripting/defaults/DefaultParameterHandler.java:69 and there is the call to
typeHandlerRegistry.hasTypeHandler(parameterObject.getClass()), which, in turn, goes to
mybatis-3.2.2-sources.jar!/org/apache/ibatis/type/TypeHandlerRegistry.java:140 and then, since jdbcType argument is null (see the code below)
public boolean hasTypeHandler(Class<?> javaType) {
return hasTypeHandler(javaType, null);
}
and then
mybatis-3.2.2-sources.jar!/org/apache/ibatis/type/TypeHandlerRegistry.java:180 fails to find a type handler.
So the question is - what's wrong there? And how to pass jdbctype explicitly to parameters?