This is ok.

Christian

-----Original Message-----
From: Warren [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 21 November 2006 19:24
To: [email protected]
Subject: Dynamic Mapped Statement Iterate Question

I want to pass a list of objects to a SQL map and get the following SQL
Statement

SELECT field1, field2, ... FROM table WHERE (field1 = 'value1' AND
field2 = 'value2') OR (field1 = 'value3' AND field2 = 'value4') ... x n

Is the folowing SQL Map correct?

  <select id="getBatchedItems" parameterClass="java.util.List" 
resultMap="batchedItemsResult">
      SELECT SIL_INV_FK, SIL_INV_CFK, SIL_Description FROM
StockInventory
      <dynamic prepend="WHERE">
          <iterate prepend="AND" property="itemList" open="(" close=")" 
conjunction="OR">
              SIL_INV_FK=#itemList[].pk# AND
              SIL_INV_CFK=#itemList[].cpk#
          </iterate>
      </dynamic>
  </select>

itemList would be a List of Item objects each having a property named pk
and cpk

Thanks,

Warren

Reply via email to