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#.
|