-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Invalid index 0 for this OracleParameterCollection
PostPosted: Thu Oct 19, 2006 4:53 am 
Newbie

Joined: Thu Sep 07, 2006 4:53 am
Posts: 3
Hi, i'm trying to migrate to beta version of NHibernate and i'm experiencing oracle parameters parsing problem with a very simplistic call (nor functions nor procs).
There must be some bug as this query does not have parameters...

Hibernate version:
1.2.0.Beta1

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="Be.StibMivb.SVoi.Domain" assembly="Be.StibMivb.SVoi.Domain" default-access="field.camelcase-underscore" default-lazy="false">
<class name="Depot" table="Depots" mutable="false">
<jcs-cache usage="read-only" />
<id name="ObjectId" unsaved-value="0" column="Id" type="Int32">
<generator class="assigned"/>
</id>
<property name="Created" column= "Created" update="false"/>
<property name="CreatedBy" column= "CreatedBy" update="false" type="String" length="50"/>
<property name="Modified" column="Modified" />
<property name="ModifiedBy" column="ModifiedBy" type="String" length="50"/>
<property name="Code" column= "Code" type="String" length="10"/>
<property name="Description" column= "Description" type="String" length="255"/>
<property name="TransportModes" column= "TransportModes" type="Be.StibMivb.SVoi.Domain.TransportModes, Be.StibMivb.SVoi.Domain" />
</class>
</hibernate-mapping>

Here's an extract of the code:
public virtual void TestSimpleSelect()
{
ICriteria criteria = Session.CreateCriteria(MappedType);
criteria.SetMaxResults(5);
IList results = criteria.List();
Assert.IsNotNull(results, "Criteria.List returned a null value.");
Assert.IsTrue(results.Count > 0, "Criteria.List returned and empty list.");

foreach(object item in results)
Assert.IsTrue(MappedType.IsAssignableFrom(item.GetType()), string.Format("Loaded items are not inheriting from {0}.", MappedType.GetType().FullName));

Debug.WriteLine(results.Count.ToString() + " items loaded." );
}

Full stack trace of any exception that occurs:
at System.Data.OracleClient.OracleParameterCollection.RangeCheck(Int32 index)
at System.Data.OracleClient.OracleParameterCollection.GetParameter(Int32 index)
at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)
at NHibernate.Loader.Loader.BindLimitParameters(IDbCommand st, Int32 index, RowSelection selection, ISessionImplementor session) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1246
at NHibernate.Loader.Loader.PrepareQueryCommand(SqlString sqlString, QueryParameters parameters, Boolean scroll, ISessionImplementor session) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1196
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 391
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 183
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1646
--- End of inner exception stack trace ---
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1656
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1600
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Loader.cs:line 1594
at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Loader\Criteria\CriteriaLoader.cs:line 66
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 5047
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 4989
at NHibernate.Impl.CriteriaImpl.List() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs:line 300
at Be.StibMivb.SVoi.Domain.Test.HibernateMappingTest.TestSimpleSelect() in E:\My Projects\StibMivb\SVoi\Design And Implementation\Src\Be.StibMivb.SVoi.Domain.Test\HibernateMappingTest.cs:line 35

Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):
SELECT this_.Id as Id1_0_, this_.Created as Created1_0_, this_.CreatedBy as CreatedBy1_0_, this_.Modified as Modified1_0_, this_.ModifiedBy as ModifiedBy1_0_, this_.Code as Code1_0_, this_.Description as Descript7_1_0_, this_.TransportModes as Transpor8_1_0_ FROM Depots this_

I'm stuck :(


Top
 Profile  
 
 Post subject: By the way, here's the exception message ;)
PostPosted: Thu Oct 19, 2006 4:56 am 
Newbie

Joined: Thu Sep 07, 2006 4:53 am
Posts: 3
By the way, here's the exception message ;)

Test method Be.StibMivb.SVoi.Domain.Test.DepotHibernateMappingTest.TestSimpleSelect threw exception: NHibernate.ADOException: could not execute query[SQL: SELECT this_.Id as Id1_0_, this_.Created as Created1_0_, this_.CreatedBy as CreatedBy1_0_, this_.Modified as Modified1_0_, this_.ModifiedBy as ModifiedBy1_0_, this_.Code as Code1_0_, this_.Description as Descript7_1_0_, this_.TransportModes as Transpor8_1_0_ FROM Depots this_] ---> System.IndexOutOfRangeException: Invalid index 0 for this OracleParameterCollection with Count=0..

Tx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:02 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This should be fixed in the upcoming beta2.


Top
 Profile  
 
 Post subject: Ok, i'll wait for beta 2
PostPosted: Thu Oct 19, 2006 5:11 am 
Newbie

Joined: Thu Sep 07, 2006 4:53 am
Posts: 3
Ok, i'll wait for beta 2

Tx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:23 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You can also try the current SVN version.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.