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 Tony Johnson <li...@deepcode.co.uk> on 2007/10/25 18:14:00 UTC

Iterators and IsEqual

Anyone know why the following wouldn't work?

 

I've tried to shrink this down to the simplest solution, but in essence I
have a class, with an ID and a collection of it's own type called Nested.
Ie:

 

Public class Nested

{

      ..

      Public int ID{ get; set; }

      Public List<Nested> NestedItems{ get; set; }

}

 

In ibatis I then have a statement thus;

 

<statement id="test" parameterClass="Nested">

      <iterate property="NestedItems" prepend="" conjunction="" open=""
close="">

            <isEqual property="NestedItems[].ID" compareValue="1">

            .. do something ..

            </isEqual>

            <isNotEqual property="NestedItems[].ID" compareValue="1">

            .. do something else ..

            </isNotEqual>

</iterate>

</statement> 

 

Idea being I want to iterate over the collection, and take one of two
actions depending on a property value that I'm iterating over.

 

This throws an exception though;

IBatisNet.Common.Exceptions.ProbeException: Error getting ordinal value from
.net object. CauseInput string was not in a correct format. --->
System.FormatException: Input string was not in a correct format..

 

I can of course write SQL to do the same job, but ideally I'd like to use
the features of IBATIS to do this for me..

 

Any ideas?

 

Cheers

Tony