You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by "Nicholas L. Piasecki" <ni...@piasecki.name> on 2008/09/18 23:25:40 UTC
Iterating over a parameterClass="list"
Hello all,
I'm trying to pass a list of objects to a statement, iterate over those
objects, and inspect and retrieve particular properties on each iteration
while I'm inside the iterate tag.
It's the following set up:
<select
id="GetProductsByFilteredSearchOptions"
parameterClass="list"
resultMap="ResultMapProduct">
SELECT
<include refid="FragmentSelectProduct" />
<dynamic prepend="WHERE">
<iterate open="" close="" conjunction="">
<isEqual
compareValue="Brand"
prepend="AND"
property="[].Name">
b.Name = #[].SelectedValue#
</isEqual>
</iterate>
</dynamic>
</select>
Assume that the list is an ICollection of objects that have a "Name" and a
"SelectedValue" property; e.g.,
public class FilteredSearchOption
{
public string Name { get { return _name; } }
public string SelectedValue { get { return _selectedValue; } } }
The problem is that I get the following error in DataMapper 1.6.1:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo
info) +112
System.Convert.ToInt32(String value) +68
IBatisNet.Common.Utilities.Objects.ObjectProbe.GetArrayMember(Object obj,
String indexedName, AccessorFactory accessorFactory) +182
It seems to be dying when reading the property attribute of the isEqual tag.
I can probably work around this, but does anyone know if this is (a)
supported, (b) a known issue, or (c) me being an idiot and declaring this
incorrectly? IBATISNET-278 sounds similar, but I'm not sure if it's the same
issue. I appreciate the help.
V/R,
Nicholas Piasecki
Software Developer
Skiviez, Inc.
1-800-628-1693 x6003
nick@skiviez.com