Nested iterate

248 views
Skip to first unread message

Timo Hermans

unread,
Apr 17, 2012, 8:07:16 AM4/17/12
to mybatisnet-user
Hi all,

I'm trying to iterate through a list. In that list I'm trying to
iterate through a list within that list.

Example code:

<iterate property="OuterList" conjunction="OR" open="" close=""
prepend="AND">
(r.reportData1= #OuterList[].propertyA# AND r.reportData2
IN (
<iterate property="OuterList[].InnerList" conjunction=","
open="" close="">
$OuterList[].InnerList[].value$
</iterate>
))
</iterate>

I'm getting the following exception when I'm trying to run this:

IBatisNet.Common.Exceptions.ProbeException: Error getting ordinal
value from .net object. CauseInput string was not in a correct format.
Input string was not in a correct format.
at IBatisNet.Common.Utilities.Objects.ObjectProbe.GetMember(Object
obj, String memberName, AccessorFactory accessorFactory).........//

Anyone any ideas? I searched on the web but the only result I found
was that a java user got the exact same problem, but he was using an
older version of ibatis (only supported in java ibatis 2.2.0).

I'm running on 1.6.2.

Help would be appreciated!

Debal Saha

unread,
Apr 17, 2012, 9:24:03 AM4/17/12
to mybatis...@googlegroups.com
I'm not sure , pl check your property data type in class and database , suppose I have a Table name student , there is some columns let's say one column is student name , so it should be string .......most probably like this ...

Your exception is saying input string is not found .... so I guess that ....

From: Timo Hermans <timo.h...@techconnect.nl>
To: mybatisnet-user <mybatis...@googlegroups.com>
Sent: Tuesday, 17 April 2012 5:37 PM
Subject: Nested iterate

Timo Hermans

unread,
Apr 17, 2012, 9:31:54 AM4/17/12
to mybatisnet-user
Thank you for your reply!

I'm passing the property into a hashtable. So in the .cs file it looks
like this:


insert method:

List<Temp> temp = new List<Temp>();
temp.add(new Temp() { ....//adding data here.... }

Hashtable htParams = new Hashtable();
htParams.add("OuterList", temp);

//select statement etc. etc...

temp class:

public class Temp {
public string PropertyA { get; set; }
public List<int> InnerList { get; set; }
}

So the data type you are saying is List<int>. So I'm confused why
OuterList[].InnerList is not a valid property?

On Apr 17, 3:24 pm, Debal Saha <debal_s...@yahoo.com> wrote:
> I'm not sure , pl check your property data type in class and database , suppose I have a Table name student , there is some columns let's say one column is student name , so it should be string .......most probably like this ...
>
> Your exception is saying input string is not found .... so I guess that ....
>
> ________________________________
>  From: Timo Hermans <timo.herm...@techconnect.nl>

Debal Saha

unread,
Apr 17, 2012, 10:28:30 AM4/17/12
to mybatis...@googlegroups.com
iterate property="OuterList[].InnerList"
I'm confusing by this line , in hasshtable it is key value pair , so , may be pl check this line ...I'm not sure

From: Timo Hermans <timo.h...@techconnect.nl>
To: mybatisnet-user <mybatis...@googlegroups.com>
Sent: Tuesday, 17 April 2012 7:01 PM
Subject: Re: Nested iterate

Lung Chan

unread,
Sep 6, 2012, 8:34:32 AM9/6/12
to mybatis...@googlegroups.com
Hi, I'm pretty sure the 1.6.2 version doesn't support nested iteration and conditional tag inside a iterate tag.

I've download the source try to modify it, but still can't make it work.

I've found this.

https://issues.apache.org/jira/browse/IBATISNET-278

Michael McCurrey

unread,
Sep 6, 2012, 8:59:51 AM9/6/12
to mybatis...@googlegroups.com
It currently does not support this.
--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Lung Chan

unread,
Sep 6, 2012, 10:39:41 AM9/6/12
to mybatis...@googlegroups.com, mic...@mccurrey.com
Is the new version mybatisnet 3.0 support that?

I try to use the preview 3.0 version, but some classes that I use for configuration doesn't exist anymore, like DomSqlMapBuilder,
SqlMapper.

Also the namespace has all changed, so I find the transition not easy.

Correct me if I'm wrong.
.

Richard Beacroft

unread,
Oct 14, 2013, 6:34:47 PM10/14/13
to mybatis...@googlegroups.com
Hi,

Please see the following post: https://groups.google.com/d/msg/mybatisnet-user/yEE5woOX1CA/_3_p-Mob92MJ
There is an SQLite unit test in the attached file to that post to try and illustrate this: TestTwoDifferentItemsInArrayUsingTwoDifferentComparisonMechanismsWithVariableBinding

Regards,
Rik
Reply all
Reply to author
Forward
0 new messages