I'm having an issue with using a custom type hander. I'm trying to convert a
yes/no db value to a True/False bool value. The read part of the type handler
works fine as in when there is a Yes/No stored in db, it gets converted to the
proper bool value.
However, no conversion occurs when I try to update the DB. I've looked at docs
and can't see what I'm doing wrong. The SetParameter(..) method which I've
implemented based on the ITypeHandlerCallback is NEVER called and the logs read
as "param6=[Stackable,True]" which I think should be "param6=[Stackable,Yes]"
Here is my XML. Any help is appreciated. Thanks.
<alias>
<typeAlias alias="BoolYesNo" type="my.namespace.BoolYesNoTypeHandler"/>
</alias>
<insert id="insertShipmentDimensions" parmaterMap="parameterDimensions">
INSERT INTO nlmi_dimensions (ShipmentId, Pieces, Weight, Length,
Width, Height, Stackable)
VALUES (#ShipmentId#, #Pieces#, #Weight#, #Length#,
#Width#, #Height#, #Stackable#)
</insert>
<parameterMaps>
<parameterMap id="parameterDimensions" class="my.namespace.vo.Dimensions">
<parameter property="ShipmentId" column="ShipmentId"/>
<parameter property="Pieces" column="Pieces"/>
<parameter property="Weight" column="Weight"/>
<parameter property="Length" column="Length"/>
<parameter property="Width" column="Width"/>
<parameter property="Height" column="Height"/>
<parameter property="Stackable" column="Stackable"
typeHandler="BoolYesNo"/>
</parameterMap>
</parameterMaps>
<!-- READING FROM THE DATABASE WORKS FINE SO BELOW CODE IS NOT A PROBLEM. JUST
INCUDED FOR COMPLETENESS -->
<select id="getDimensions" resultMap="resultDimensions">
SELECT *
FROM dimensions
WHERE ShipmentId = #value#
</select>
<resultMaps>
<resultMap id="resultDimensions" class="my.namespace.vo.Dimensions">
<result property="ShipmentId" column="ShipmentId"/>
<result property="Pieces" column="Pieces"/>
<result property="Weight" column="Weight"/>
<result property="Length" column="Length"/>
<result property="Width" column="Width"/>
<result property="Height" column="Height"/>
<result property="Stackable" column="Stackable"
typeHandler="BoolYesNo"/>
</resultMap>
</resultMaps>