Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-787

Type Handler ignored in dynamic sql block

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.4
    • None
    • Core
    • None
    • Windows XP

    Description

      When I use the dynamic tag in my sql map, and then create an inline-parameter for a JDBC type (e.g. XMLTYPE), the type handler that is configured in my sqlMapConfig file is ignored. However, when I eliminate the dynamic tag, the type handler is invoked.

      Here is an example of a dynamic block that fails:

      <update id="updateByPrimaryKeySelective" parameterClass="component">
      update COMPONENT_XML
      <dynamic prepend="set">
      <isNotNull prepend="," property="componentTypePK">
      COMPONENT_TYPE_ID = #componentTypePK:DECIMAL#
      </isNotNull>
      <isNotNull prepend="," property="xmlData">
      XML_DATA = #xmlData,javaType=oracle.xdb.XMLType,jdbcType=XMLTYPE#
      </isNotNull>
      <isNotNull prepend="," property="inactiveDate">
      INACTIVE_DATE = #inactiveDate:TIMESTAMP#
      </isNotNull>
      </dynamic>
      where UUID = #uuid:VARCHAR#
      </update>

      Here is one that works:

      <update id="updateByPrimaryKey" parameterClass="component">
      update COMPONENT_XML
      set COMPONENT_TYPE_ID = #componentTypePK:DECIMAL#,
      XML_DATA = #xmlData,javaType=oracle.xdb.XMLType,jdbcType=XMLTYPE#
      where UUID = #uuid:VARCHAR#
      </update>

      sqlMapConfig:

      <?xml version="1.0" encoding="UTF-8" ?>

      <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
      "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

      <sqlMapConfig>
      <settings useStatementNamespaces="true"/>
      <typeHandler javaType="oracle.xdb.XMLType"
      callback="<some-package>/.XMLTypeHandlerCallback"/>
      <sqlMap resource="sql/XML_SqlMap.xml"/>
      <sqlMap resource="/ISOMD_COMPONENT_TYPE_SqlMap.xml"/>
      </sqlMapConfig>

      Attachments

        Activity

          People

            Unassigned Unassigned
            russ.baker@noaa.gov Russ Baker
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: