After digging a long, long while I have finally found the answer.
This seems to be a bug in myBatis.
In order to get your handlers to work for <result>
elements, you have to specify column
attribute explicitly even if property
attribute already matches column name and field name in bean.
In my case, it looks like this:
<result property="SERVICES_XML" column="SERVICES_XML" javaType="string" jdbcType="CLOB" typeHandler="com.foo.bar.OracleClobTypeHandler" />
Note that the above change will also cause handlers defined in <configuration>
tag to work, so inline typeHandler
may be no longer necessary - that was my case. I ended up with:
<configuration>
<typeHandlers>
<typeHandler javaType="java.lang.String" jdbcType="CLOB" handler="com.foo.bar.OracleClobTypeHandler"/>
</typeHandlers>
</configuration>
and
<result property="SERVICES_XML" column="SERVICES_XML" javaType="string" jdbcType="CLOB" />