Need help in SqlMap.xml

View: New views
2 Messages — Rating Filter:   Alert me  

Need help in SqlMap.xml

by liny :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, below is the content of my SqlMap.xml
<?xml version="1.0" encoding="UTF-8" ?>

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

<sqlMap namespace="acm.wafer">
 
  <cacheModel id="productCache" type="LRU" readOnly="true" serialize="false">
    <flushInterval hours="24"/>
    <property name="size" value="1000" />
  </cacheModel>
 
  <!-- Use type aliases to avoid typing the full classname every time. -->
  <typeAlias alias="waferData" type="acm.wafer.model.WaferData"/>
  <typeAlias alias="invoiceWaferQuery" type="acm.wafer.model.InvoiceWaferQuery"/>
 
  <!-- Result maps describe the mapping between the columns returned
       from a query, and the class properties.  A result map isn't
       necessary if the columns (or aliases) match to the properties
       exactly. -->
  <resultMap id="invoiceWaferMap" class="acm.wafer.model.InvoiceWafer">
    <result property="extDelivery" column="EXT_DELIVERY"/>
    <result property="material" column="MATERIAL"/>
    <result property="invoiceBatchNo" column="BATCH"/>
    <result property="deliveryQty" column="DELIVERY_QTY"/>    
    <result property="batchNo" column="BATCH_NO"/>
    <result property="qty" column="qty"/>
    <result property="dieName" column="DIE_NAME"/>
    <result property="receiveDttm" column="RECEIVE_DATE"/>
    <result property="boxes" column="boxes"/>
  </resultMap>
 
  <insert id="insertWaferData" parameterClass="waferData" >
    insert into acm_wafer_data
    values(#batchNo#, #dieName#, #qty#, #receiveDttm#, #boxes#)
  </insert>
 
  <select id="getInvoiceWaferData" parameterClass="invoiceWaferQuery" resultMap="invoiceWaferMap">
    select EXT_DELIVERY, MATERIAL, BATCH, DELIVERY_QTY, BATCH_NO,
           sum(DIE_QTY) qty, DIE_NAME, RECEIVE_DATE,
           sum(BOX_COUNT) boxes
    from
    (
      select * from acm_wafer_invoice sap,acm_wafer_data info
      where sap.batch = info.batch_no(+)
        and sap.material = info.die_name(+)
        <isParameterPresent>
          <isNotNull prepend="and" property="batchNo">
            info.batch_no = #batchNo#
          </isNotNull>
          <isNotNull prepend="and" property="dieName">
            info.die_name = #dieName#
          </isNotNull>    
          <isNotNull prepend="and" property="fromDate">
            info.receive_dttm >= #fromDate#
          </isNotNull>
        </isParameterPresent>
      union
      select * from acm_wafer_invoice sap,acm_wafer_data info
      where sap.batch(+) = info.batch_no
        and sap.material(+) = info.die_name
        <isParameterPresent>
          <isNotNull prepend="and" property="batchNo">
            info.batch_no = #batchNo#
          </isNotNull>
          <isNotNull prepend="and" property="dieName">
            info.die_name = #dieName#
          </isNotNull>
          <isNotNull prepend="and" property="toDate">
            info.receive_dttm <= #toDate#
          </isNotNull>
        </isParameterPresent>
    )
    group by EXT_DELIVERY, MATERIAL, BATCH, DELIVERY_QTY, BATCH_NO,
             DIE_NAME, RECEIVE_DATE, GROUP_ID

  </select>
</sqlMap>


And iBatis throws exception while loading xml file.
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.     at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)     at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)     at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)     at com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:157)     at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)     at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.java:51)     at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMapConfigParser.java:410)     at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)     at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:84)     at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)     at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)     at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)     at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)     at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)

What's wrong with it?
Thanks for any suggestion!

Re: Need help in SqlMap.xml

by liny :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I got the answer~
<=   should be changed to <![CDATA[ <= ]]>
>=   should be changed to <![CDATA[ >= ]]>
LightInTheBox - Buy quality products at wholesale price!