ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pieper, Aaron (SAIC)" <Piep...@Pragmatics.com>
Subject Referencing iterable fields as properties of a dynamic SQL statement
Date Mon, 01 Dec 2008 23:11:56 GMT
I'm having a problem using iBatis to implement a dynamic SQL query. For
this query, the user specifies a list of strings, and they're allowed to
specify "null". I want iBatis to query for the records matching the
strings they specify. If they specify "null" as one of the list
elements, then I want to include null records in my response.

My query worked OK until I tried to incorporate the null case. My SQL
map with the null case included looks something like this:

------------------------------------------------------------
SELECT *
FROM foo
WHERE
<iterate property="searchCriteria" conjunction=" OR ">
	<isNotNull property="searchCriteria[]">
		foo.bar=#searchCriteria[]#
	</isNotNull>
	<isNull property="searchCriteria[]">
		foo.bar is null
	</isNull>
</iterate>
------------------------------------------------------------

This produces a NumberFormatException, caused by "searchCriteria[]"
being specified as a property. If I change the property to
"searchCriteria" (without the braces) instead, then I don't get the
exception (but the resulting behavior is incorrect.)

This looks very close to the tracker IBATIS-42
(http://issues.apache.org/jira/browse/IBATIS-42) but that particular
tracker was marked as fixed in version 2.1.0, and I'm still seeing this
problem in 2.1.7.597. Should I submit a new tracker?

-	Aaron Pieper

Mime
View raw message