-->
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.  [ 2 posts ] 
Author Message
 Post subject: Unable to do search on List
PostPosted: Fri Feb 25, 2005 11:31 am 
Newbie

Joined: Fri Feb 25, 2005 11:07 am
Posts: 1
Hi

I hope someone can help me out on this one.
I keep getting : "Index was outside the bounds of the array." exception when doing search on collection.


Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Blah.Stranka,Blah" table="STRANKE">
<id name="Sifra" column="SIFRA" type="integer" unsaved-value="-1">
<generator class="native" />
</id>
<list name="NHibernate_Transakcijski_racun" table="STR" lazy="false" >
<key> <column name="SIFRA"/></key>
<index column="RACUN_IDX"/>
<element column="TRANSAKCIJSKI_RACUN" type="string" length="50"/>
</list>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

ICriteria criteria = sess.CreateCriteria(obj.GetType());
criteria.SetMaxResults(50);
criteria.Add(Expression.Like("NHibernate_Transakcijski_racun", someString));
criteria.Add(Expression.Eq("Sifra",someSifra));

IList results = null;
NHibernate.NHibernate.Initialize(results);
results = criteria.List();

This FAILS!!!! :(


Full stack trace of any exception that occurs:
at NHibernate.Expression.SimpleExpression.ToSqlString(ISessionFactoryImplementor factory, Type persistentClass, String alias)
at NHibernate.Expression.Junction.ToSqlString(ISessionFactoryImplementor factory, Type persistentClass, String alias)
at NHibernate.Loader.CriteriaLoader..ctor(ILoadable persister, ISessionFactoryImplementor factory, ICriteria criteria)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List()
at myFunction( someString, Int32 someSifra)



I'm using MSSQL and C#.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 12:07 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
C# ?

You're barking up the wrong tree:

http://nhibernate.sourceforge.net/
http://sourceforge.net/forum/forum.php?forum_id=252014


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.