You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Robert Campbell <rr...@gmail.com> on 2006/06/29 10:45:03 UTC

used to work, now fails

Here is my code:

    <select id="findAwards" resultMap="awardResult" parameterClass="
java.util.List">
        select * from award2 where
        <iterate conjunction="AND">
            UPPER(award_name) LIKE #value[]#
        </iterate>
        ORDER BY award_id
    </select>

This used to work perfectly. Then it suddenly stopped working, and I'm
unable to track down why. Please give me suggestions on how to troubleshoot
the problem. I have log4j debug turned on, and here is what is produced:

2006-06-29 10:37:05,046 [http-8070-Processor23] DEBUG
java.sql.PreparedStatement(23) - {pstm-100010} PreparedStatement:
select * from award2 where               UPPER(award_name) LIKE
?                   ORDER BY award_id
2006-06-29 10:37:05,046 [http-8070-Processor23] DEBUG
java.sql.PreparedStatement(23) - {pstm-100010} Parameters: ['%AWA%']
2006-06-29 10:37:05,046 [http-8070-Processor23] DEBUG
java.sql.PreparedStatement(23) - {pstm-100010} Types: [java.lang.String]
2006-06-29 10:37:05,077 [http-8070-Processor23] DEBUG java.sql.ResultSet(23)
- {rset-100011} ResultSet

As you can see, it generates the SQL fine, but returns an empty ResultSet.
The SQL generation also works fine if I pass in a list of more then one
elements. If I take out the iterate, and I simple have:

    <select id="findAwards" resultMap="awardResult" parameterClass="
java.util.List">
        select * from award2 where

            UPPER(award_name) LIKE '%AWA%'

        ORDER BY award_id
    </select>

It suddenly works again. Thank you!