title: uuid custom typehandler mybatis
body: <p>I want to manage a table with a VARCHAR primary key, that in the
  mapped java object should be a UUID.</p>
  
  <p>i have my <code>sql-map-config.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE configuration
     PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
     "http://mybatis.org/dtd/mybatis-3-config.dtd"&gt;
  
  &lt;configuration&gt;
         &lt;properties resource="database.properties"/&gt;
     &lt;typeHandlers&gt;
         &lt;typeHandler
  handler="[...].persistence.typehandlers.UuidTypeHandler"
                      javaType="java.util.UUID"
                      jdbcType="VARCHAR"/&gt;
     &lt;/typeHandlers&gt;
         &lt;environments default="development"&gt;
                 &lt;environment id="development"&gt;
                         &lt;transactionManager type="JDBC" /&gt;
                         &lt;dataSource type="POOLED"&gt;
                                 &lt;property name="driver" value="${driver}" /&gt;
                                 &lt;property name="url" value="${url}" /&gt;
                                 &lt;property name="username" value="${username}" /&gt;
                                 &lt;property name="password" value="${password}" /&gt;
                         &lt;/dataSource&gt;
                 &lt;/environment&gt;
         &lt;/environments&gt;
         &lt;mappers&gt;
                 &lt;mapper resource="user.xml" /&gt;
     &lt;/mappers&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and the <code>user.xml</code> is like that:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  
  &lt;mapper namespace="[...].persistence.mappers.UserMapper"&gt;
  
     &lt;select id="selectUserByUUID" parameterType="java.util.UUID"
  resultMap="userResultMap"&gt;
         SELECT * FROM user WHERE uuid = #{uuid, jdbcType=VARCHAR,
  typeHandler=[...].persistence.typehandlers.UuidTypeHandler}
     &lt;/select&gt;
     &lt;resultMap id="userResultMap" type="[...].model.User"&gt;
         &lt;id property="uuid" column="uuid" jdbcType="OTHER"
  typeHandler="[...].persistence.typehandlers.UuidTypeHandler"/&gt;
         ...
     &lt;/resultMap&gt;
  &lt;/mapper&gt;
  </code></pre>
  
  <p>anyway, i got this exception:</p>
  
  <pre><code>org.apache.ibatis.exceptions.PersistenceException:
  ### Error querying database.  Cause:
  org.apache.ibatis.reflection.ReflectionException: There is no getter
  for property named 'uuid' in 'class java.util.UUID'
  ### The error may involve
  [...].persistence.mappers.UserMapper.selectUserByUUID-Inline
  ### The error occurred while setting parameters
  ### Cause: org.apache.ibatis.reflection.ReflectionException: There is
  no getter for property named 'uuid' in 'class java.util.UUID'
  </code></pre>
  
  <p>it seems that my typehandler never gets called (i have it logging a
  bit, but never prints anything).
  Is there something wrong? Thanks.</p>