Title: Lazy loading problem in Tutorial2 example

Hi,

I'm currently evaluating iBatis.net (DataMapper 1.5.0 and DataAccess 1.8.0) in VS2005. So I started with het Tutorial2 example I found on http://people.apache.org/dist/ibatis/ibatis.net/beta/tutorial2.zip on an Oracle 10g database.

In the supplied NUnit-test SelectAuthorAndBlogAndLazyPost() I get an error:

IBatisNet.DataMapper.SqlMapSession - Open Connection "3501721" to "Oracle, Microsoft provider V1.0.5000.0".
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Author-Select] PreparedStatement : [SELECT        Authors.ID as AuthorID,        Authors.Name as AuthorName,        Authors.Login as AuthorLogin,        Authors.Password as AuthorPassword,        Blogs.ID as BlogID,        Blogs.Name as BlogName,        Blogs.Description as BlogDescription        FROM Authors, Blogs              WHERE        (Authors.ID =  :param0 )        AND        (Blogs.AuthorID = Authors.ID)]

IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Author-Select] Parameters: [param0=[value,2]]
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Author-Select] Types: [param0=[Int32, System.Int32]]

IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Post-Fill] PreparedStatement : [SELECT *        FROM Posts        WHERE        (BlogID =  :param0 )]

IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Post-Fill] Parameters: [param0=[value,1]]
IBatisNet.DataMapper.Commands.DefaultPreparedCommand - Statement Id: [Post-Fill] Types: [param0=[Decimal, System.Decimal]]

IBatisNet.DataMapper.SqlMapSession - Close Connection "3501721" to "Oracle, Microsoft provider V1.0.5000.0".
TestCase 'Tutorial2.Test.TestDataMapper.SelectAuthorAndBlogAndLazyPost'
failed: System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> System.IndexOutOfRangeException : Content
        at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

        at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

        at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

        at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

        at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\PostSelectStrategy\GenericListStrategy.cs(78,0): at IBatisNet.DataMapper.MappedStatements.PostSelectStrategy.GenericListStrategy.Execute(PostBindind postSelect, RequestScope request)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(917,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecutePostSelect(RequestScope request)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(336,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject[T](RequestScope request, IDalSession session, Object parameterObject, T resultObject)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(307,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](IDalSession session, Object parameterObject, T resultObject)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(288,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](IDalSession session, Object parameterObject)

        \Source-revision-419277\IBatisNet.DataMapper\SqlMapper.cs(735,0): at IBatisNet.DataMapper.SqlMapper.QueryForObject[T](String statementName, Object parameterObject)

        C:\pdvl\downloads\ORM\iBatis\tutorial2\tutorial2\Tutorial2.Test\TestDataMapper.cs(38,0): at Tutorial2.Test.TestDataMapper.SelectAuthorAndBlogAndLazyPost()

        --TargetInvocationException
        at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
        at System.Data.OracleClient.OracleDataReader.GetOrdinal(String name)
        \Source-revision-419277\IBatisNet.DataMapper\TypeHandlers\StringTypeHandler.cs(52,0): at IBatisNet.DataMapper.TypeHandlers.StringTypeHandler.GetValueByName(ResultProperty mapping, IDataReader dataReader)

        \Source-revision-419277\IBatisNet.DataMapper\Configuration\ResultMapping\ResultProperty.cs(403,0): at IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty.GetDataBaseValue(IDataReader dataReader)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\PropertStrategy\DefaultStrategy.cs(79,0): at IBatisNet.DataMapper.MappedStatements.PropertyStrategy.DefaultStrategy.Set(RequestScope request, ResultMap resultMap, ResultProperty mapping, Object& target, IDataReader reader, Object keys)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\ResultStrategy\ResultMapStrategy.cs(73,0): at IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultMapStrategy.Process(RequestScope request, IDataReader reader, Object resultObject)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(642,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList[T](RequestScope request, IDalSession session, Object parameterObject, Int32 skipResults, Int32 maxResults, RowDelegate`1 rowDelegate)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(593,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](IDalSession session, Object parameterObject, Int32 skipResults, Int32 maxResults)

        \Source-revision-419277\IBatisNet.DataMapper\MappedStatements\MappedStatement.cs(574,0): at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](IDalSession session, Object parameterObject)


0 passed, 1 failed, 0 skipped, took 2,00 seconds.


Has it something to do with the type of param0? I wonder why the type of param0 for Post-Fill is Decimal, I've changed the parameterClass to int in post.xml

  <select id="Post-Fill" parameterClass="int" resultMap="Post-Result" >
      SELECT *
      FROM Posts
      WHERE
      (BlogID = #value#)
    </select>

Without the modification I get the same problem, but I understand what the original parameterClass="map" stands for...

Has anybody a clue of the source of my problem? Is it an error in Tutorial2 or a bug in iBatis?

Cheers,
Paul


Reply via email to