Hi Rick,If the property type is primitive boolean, you may need to add another annotation to your YNBooleanTypeHandler.@MappedTypes(boolean.class)
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.VARCHAR, JdbcType.CHAR}, includeNullJdbcType=true)
@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.INTEGER, JdbcType.TINYINT, JdbcType.NUMERIC}, includeNullJdbcType=true)It looks like according to the docs, I shouldn't need to set the jdbcType on the result map element if I also set the MappedJdbcTypes, so I'm a bit confused what the issue is? It must have to do with the fact that I'm mapping both typeHandlers to a boolean?
I can go through and set the jdbcTypes on the elements in the result maps, but it would sort of be nice to not have to do this.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Rick,You cannot assign two type handlers to the same combination of java type and jdbc type (including null jdbc type).This makes sense because MyBatis uses this combination to pick a type handler.
With the current implementation, you would have to specify jdbcType on every boolean property if you want to use two type handlers for a single java type.I'll see if it's possible to overcome the inconvenience.Regards,Iwao2016-08-23 23:00 GMT+09:00 Rick R <ric...@gmail.com>:Ok, I'm going to come back to this a bit since I'm curious about something.In our case I need to type handlers for boolean.. some columns are 0/1 some are Y/NOn retrievals things work only if I also declare the jdbcType at the result map element level (eg jdbcType="CHAR" )Even though on the typeHandlers I've set the various jdbc types declared:@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.VARCHAR, JdbcType.CHAR}, includeNullJdbcType=true)
@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.INTEGER, JdbcType.TINYINT, JdbcType.NUMERIC}, includeNullJdbcType=true)It looks like according to the docs, I shouldn't need to set the jdbcType on the result map element if I also set the MappedJdbcTypes, so I'm a bit confused what the issue is? It must have to do with the fact that I'm mapping both typeHandlers to a boolean?
I can go through and set the jdbcTypes on the elements in the result maps, but it would sort of be nice to not have to do this.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.VARCHAR, JdbcType.CHAR}, includeNullJdbcType=true)
public class YNBooleanTypeHandler extends BaseTypeHandler<Boolean> {
and
@MappedTypes(boolean.class)
@MappedJdbcTypes(value={JdbcType.INTEGER, JdbcType.TINYINT, JdbcType.NUMERIC}, includeNullJdbcType=true)
public class ZeroOneBooleanTypeHandler extends BaseTypeHandler<Boolean> {
<update id="updateDeleteFlag">
UPDATE EXECUTION_T SET DELETE_FLG = #{markDeleted,jdbcType=CHAR}, UPDATED_TS = CURRENT_TIMESTAMP WHERE EXECUTION_ID = #{executionId}
</update>