Configured type handler not invoked on insert
---------------------------------------------

                 Key: IBATIS-568
                 URL: https://issues.apache.org/jira/browse/IBATIS-568
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.3
         Environment: Windows XP Professional
            Reporter: Richard R. Duffy


Custom type handler which is configured in the SqlMapConfig is not being 
invoked for an insert.  The configured handler is as follows:

<typeHandler javaType="javax.xml.datatype.XMLGregorianCalendar" 
jdbcType="TIMESTAMP" callback="com.aac.engine.dao.impl.TimeStampHandler"/>

The handler is called for queries (SELECT) and all TIMESTAMP data is processed 
through the handler.  However, the handler is not called on insert statements.

Sample map file entry:

<insert id="insertAllowance" parameterClass="Allowance">
    INSERT INTO allowance
    (
      jobid,
      createdate,
      allowancereminderid,
      allowancetype,
      allowancecategory,
      allowanceworkarea,
      allowanceduedate,
      allowancedescription,
      allowancematerialamounttype,
      allowancematerialamount,
      allowancematerialunits,
      allowancematerialunittype,
      allowancelaboramount,
      allowancelaborvisible
      <dynamic>
        <isPropertyAvailable property="selection">
         ,selectiondescription,
         selectionmaterialamount,
         selectionlaboramount
        </isPropertyAvailable>
      </dynamic>
    )
    VALUES
    (
      #jobid#,
      NOW(),
      #reminderid#,
      #type#,
      #category#,
      #workarea#,
      #duedate#,
      #description#,
      #materialcalculation.type#,
      #materialcalculation.typevalue#,
      #materialunits#,
      #materialunittype#,
      #labortotal#,
      #laborvisible#
      <dynamic>
        <isPropertyAvailable property="selection">
         ,#selection.description#,
         #selection.materialamount#,
         #selection.laboramount#
        </isPropertyAvailable>
      </dynamic>
    )
    <selectKey type="post" resultClass="Integer">
      SELECT LAST_INSERT_ID() AS value
    </selectKey>
  </insert>

If I use an inline type handler for the date column (duedate) within the insert 
map (such as #private,handler=com.aac.engine.dao.impl.TimeStampHandler#) then 
it works fine.  

Sample inline specification:  
#duedate,handler=com.aac.engine.dao.impl.TimeStampHandler#,

There was a similar issue reported for primitives (IBATIS-244) that was 
resolved in 2.3.3.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to