Hi,
I'm having the same problem.
The problem is on the isEqual tag. I think the tag is no reading
properly the value from "[].Field".
I tried the following:
Parameter class:
public class Xpto
{
private IList<A> lista;
public IList<A> Lista
{
get { return lista; }
}
public Xpto()
{
lista = new List<A>();
}
public class A
{
public int coiso { get; set; }
public A(int val)
{
this.coiso = val;
}
}
}
DAO:
Xpto x = new Xpto();
x.Lista.Add(new Xpto.A(4));
x.Lista.Add(new Xpto.A(3));
IList<Tag> tags = SqlMapper.QueryForList<Tag>("Tag.xpto", x);
SQLMap (without isEqual) => And it works
<select id="xpto" resultMap="FullResultMap" parameterClass="Xpto">
select *
from "tsal"."Tag"
where "Version"
<iterate property="lista" prepend="in" conjunction="," open="("
close=")">
#lista[].coiso#
</iterate>aa
</select>
SQLMap (without isEqual) => Doesn't work
<select id="xpto" resultMap="FullResultMap" parameterClass="Xpto">
select *
from "tsal"."Tag"
where "Version"
<iterate property="lista" prepend="in" conjunction="," open="("
close=")">
<isEqual property="lista[].coiso" compareValue="3" >
#lista[].coiso#
</isEqual>
</iterate>aa
</select>
Error:
===================================
Error getting ordinal value from .net object. CauseInput string was
not in a correct format. (IBatisNet.Common)
------------------------------
Program Location:
at IBatisNet.Common.Utilities.Objects.ObjectProbe.GetMember(Object
obj, String memberName, AccessorFactory accessorFactory)
at
IBatisNet.Common.Utilities.Objects.ObjectProbe.GetMemberValue(Object
obj, String memberName, AccessorFactory accessorFactory)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers.ConditionalTagHandler.Compare(SqlTagContext
ctx, SqlTag sqlTag, Object parameterObject)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers.IsEqualTagHandler.IsCondition(SqlTagContext
ctx, SqlTag tag, Object parameterObject)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers.ConditionalTagHandler.DoStartFragment(SqlTagContext
ctx, SqlTag tag, Object parameterObject)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.DynamicSql.ProcessBodyChildren(RequestScope
request, SqlTagContext ctx, Object parameterObject, IEnumerator
localChildren, StringBuilder buffer)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.DynamicSql.ProcessBodyChildren(RequestScope
request, SqlTagContext ctx, Object parameterObject, IEnumerator
localChildren, StringBuilder buffer)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.DynamicSql.ProcessBodyChildren(RequestScope
request, SqlTagContext ctx, Object parameterObject, IList
localChildren)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.DynamicSql.Process(RequestScope
request, Object parameterObject)
at
IBatisNet.DataMapper.Configuration.Sql.Dynamic.DynamicSql.GetRequestScope(IMappedStatement
mappedStatement, Object parameterObject, ISqlMapSession session)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T]
(ISqlMapSession session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String
statementName, Object parameterObject)
at
Telbit.TeStudio.DbService.Model.Dao.TagDao.SelectByExample(TagExample
example) in E:\repos\testudio\tsal_rm_1824_forcing
\Telbit.TeStudio.DbService\Model\Dao\TagDao.cs:line 21
at
Telbit.TeStudio.DbService.Service.TsalService.GetTestHistory(String
id) in E:\repos\testudio\tsal_rm_1824_forcing\Telbit.TeStudio.DbService
\Service\TsalService.cs:line 24
at
_dynamic_Telbit.TeStudio.DbService.Service.TsalService.GetTestHistory(Object ,
Object[] )
at Spring.Reflection.Dynamic.SafeMethod.Invoke(Object target,
Object[] arguments) in l:\projects\spring-net\trunk\src\Spring
\Spring.Core\Reflection\Dynamic\DynamicMethod.cs:line 156
at Spring.Aop.Framework.DynamicMethodInvocation.InvokeJoinpoint()
in l:\projects\spring-net\trunk\src\Spring\Spring.Aop\Aop\Framework
\DynamicMethodInvocation.cs:line 100
at Spring.Aop.Framework.AbstractMethodInvocation.Proceed() in l:
\projects\spring-net\trunk\src\Spring\Spring.Aop\Aop\Framework
\AbstractMethodInvocation.cs:line 259
at
Spring.Transaction.Interceptor.TransactionInterceptor.Invoke(IMethodInvocation
invocation) in l:\projects\spring-net\trunk\src\Spring\Spring.Data
\Transaction\Interceptor\TransactionInterceptor.cs:line 86
at Spring.Aop.Framework.AbstractMethodInvocation.Proceed() in l:
\projects\spring-net\trunk\src\Spring\Spring.Aop\Aop\Framework
\AbstractMethodInvocation.cs:line 284
at Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Invoke(Object
proxy, Object target, Type targetType, MethodInfo targetMethod,
MethodInfo proxyMethod, Object[] args, IList interceptors) in l:
\projects\spring-net\trunk\src\Spring\Spring.Aop\Aop\Framework
\DynamicProxy\AdvisedProxy.cs:line 217
at
CompositionAopProxy_a546c8315d254477b22755443691c0d9.GetTestHistory(String
id)
at Telbit.TeStudio.View.Program.SetupSpring() in E:\repos\testudio
\tsal_rm_1824_forcing\Telbit.TeStudio\Program.cs:line 257
at Telbit.TeStudio.View.Program.Main(String[] args) in E:\repos
\testudio\tsal_rm_1824_forcing\Telbit.TeStudio\Program.cs:line 57
===================================
Input string was not in a correct format. (mscorlib)
------------------------------
Program Location:
at System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style,
NumberFormatInfo info)
at System.Convert.ToInt32(String value)
at
IBatisNet.Common.Utilities.Objects.ObjectProbe.GetArrayMember(Object
obj, String indexedName, AccessorFactory accessorFactory)
On May 7, 8:23 pm, in dev <
indev...@gmail.com> wrote:
> I took a peek at the following source code:
http://www.java2s.com/Open-Source/CSharp/Persistence-Frameworks/iBATI...
>
> It looks like the code to resolve the index during iteration is using the
> following strategy:
> *int* startIndex = indexedName.IndexOf("[");
> *int* length = indexedName.IndexOf("]");
> *string* name = indexedName.Substring(0, startIndex);
> *string* index = indexedName.Substring( startIndex+1,
> length-(startIndex+1));
> *int* i = System.Convert.ToInt32(index);
> I decided to write some code to test that the System.Convert.ToInt32 method
> was working correctly on my system, just incase there is a regional setting
> issue.
> I executed the following code successfully:
> *int* i = System.Convert.ToInt32("5");
> Then I got to wondering, what if it was not a number, what if it was trying
> to parse the '.' operator when I am trying to access a property of the list
> item.
> *int* i = System.Convert.ToInt32(".");
> That Threw the following exception:
> System.FormatException: Input string was not in a correct format.
> at System.Number.StringToNumber(String str, NumberStyles options,
> NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
> at System.Number.ParseInt32(String s, NumberStyles style,
> NumberFormatInfo info)
> at System.Convert.ToInt32(String value)
>
> Does mybatis support iterating over a collection of objects? or does it only
> support iterating over a collection of primitive types? For example, can I
> iterate over my IList<Icriteria> collection, or is it only legal to iterate
> over a List of strings?
>
> Sincerely,
>
> indevnow.
>
> > On Wed, May 4, 2011 at 12:33 PM, in dev <
indev...@gmail.com> wrote:
>
> >> Dear Michael,
>
> >> I fixed the regional settings by removing the french key mappings using
> >> the control panel. Now I can type question marks again. Can you see this???
> >> w00t! Very happy.
> >> Unfortunately I still get exactly the same parsing error. I restarted my
> >> IDE just incase the regional settings were not realized by the IDE. I also
> >> restarted my browser. I can't wait to get this issue resolved. Thank you so
> >> much for your help.
>
> >> Cheers!
>
> >>> On Wed, May 4, 2011 at 5:57 AM, Michael McCurrey <
mmccur...@gmail.com>wrote:
>
> >>>> I'll give it a run today and post something back unless somebody beats
> >>>> me to it.. Stay tuned
>
> >>>>> On Tue, May 3, 2011 at 7:35 PM, Michael McCurrey <
mmccur...@gmail.com>wrote:
>
> >>>>>> I'm not in front of an ide right now; so forgive any syntax errors.
> >>>>>> you can definitely pass a straight list as a parameter class, just set your
> >>>>>> parameterClass to:
>
> >>>>>> parameterClass="list"
>
> >>>>>> <dynamic>
> >>>>>> <iterate open="" close="" conjunction=" " >
>
> >>>>>> <isEqual
>
> ...
>
> read more »