Hi jevget,

Can you raise a JIRA and reference this message in the groups?

Cheers,
   Richard

-----Original Message----- From: jevget
Sent: Thursday, December 09, 2010 2:10 PM
To: nhusers
Subject: [nhusers] Re: Linq on Informix using take gives an exception

There is a bug. I found in NHIbernate source code and changed
Loader.cs GetFirstLimitParameterCount method text like this:
private int GetFirstLimitParameterCount(Dialect.Dialect dialect,
bool useLimit, bool hasFirstRow, bool useOffset)
{
if (!useLimit) return 0;
if (!dialect.BindLimitParametersFirst) return 0;
                       if (!dialect.SupportsVariableLimit) return
0; //BUG
return (hasFirstRow && useOffset) ? 2 : 1;
}
now i can use my own dll :)
I hope developers will notice my post and fix this.

On Nov 17, 10:59 am, Erik <[email protected]> wrote:
Sorry,

I use the ifxdriver and the InformixDialect1000 see below

            FluentConfiguration config = Fluently.Configure()
                .Database(

                    IfxSQLIConfiguration.Informix1000
                    .ConnectionString(cnn)
                    .Driver<IfxDriver>()
                    .ProxyFactoryFactory<ProxyFactoryFactory>()
                //.ShowSql()
                    .QuerySubstitutions("true 1, false 0, yes 'Y', no
'N'")
                )

Erik

On 16 nov, 13:02, Diego Mijelshon <[email protected]> wrote:

> Again: what dialect and driver are you using?

>     Diego

> On Tue, Nov 16, 2010 at 05:51, Erik <[email protected]> wrote:
> > In my current stack where I use NH 2.1.2  and the contrib linq
> > provider (and fluent) it works fine in this situation. I am in the
> > process of upgrading to NH3 with the included Linq provider and faced
> > this problem.

> > my query is:

> >            return Storage.Context<Dossier>()
> >                    .Where(x => x.TaakCode == aktieCode &&
> >                            (x.TimestampLaatsteWijziging >=
> > obsoleteFrom) &&
> >                            (x.DatumLaatsteBetaling >= obsoleteFrom))
> >                    .OrderBy(x => x.AgendaDatum)
> >                    .Take(count)
> >                    .ToList()
> >                    .Cast<IDossier>();

> > I use the list to force the execution.

> > the sql generated is like: select first 33 from tdossiers dossier0_
> > where dossier0_.taakkode1=? and dossier0_.lts_wijzig>=? and
> > dossier0_.ltsdatum>=? order by dossier0_.agenda asc

> > I observed here that there are only 3 parameters and the take 33 is
> > part of the sql with a logical outofrange exception when trying to get
> > index 3 (see below)

> > The exception is: NHibernate.Exceptions.GenericADOException: could not
> > execute query
> > Stacktrace
> > IBM.Data.Informix.IfxParameterCollection.RangeCheck(Int32 index)
> > IBM.Data.Informix.IfxParameterCollection.GetParameter(Int32 index)

> > System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item( > > Int32
> > index)
> > NHibernate.Driver.DriverBase.ExpandQueryParameters(IDbCommand cmd,
> > SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate\Driver
> > \DriverBase.cs: line 222
> > NHibernate.AdoNet.AbstractBatcher.ExpandQueryParameters(IDbCommand
> > cmd, SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \AdoNet\AbstractBatcher.cs: line 227
> > NHibernate.Loader.Loader.PrepareQueryCommand(QueryParameters
> > queryParameters, Boolean scroll, ISessionImplementor session) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs: line 1185
> > NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
> > QueryParameters queryParameters, Boolean returnProxies) in > > d:\CSharp\NH
> > \nhibernate\src\NHibernate\Loader\Loader.cs: line 399

> > NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImp > > lementor
> > session, QueryParameters queryParameters, Boolean returnProxies) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs: line 236
> > NHibernate.Loader.Loader.DoList(ISessionImplementor session,
> > QueryParameters queryParameters) in d:\CSharp\NH\nhibernate\src
> > \NHibernate\Loader\Loader.cs: line 1665
> > NHibernate.Loader.Loader.DoList(ISessionImplementor session,
> > QueryParameters queryParameters) in d:\CSharp\NH\nhibernate\src
> > \NHibernate\Loader\Loader.cs: line 1674
> > NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
> > session, QueryParameters queryParameters) in d:\CSharp\NH\nhibernate
> > \src\NHibernate\Loader\Loader.cs: line 1589
> > NHibernate.Loader.Loader.List(ISessionImplementor session,
> > QueryParameters queryParameters, ISet`1 querySpaces, IType[]
> > resultTypes) in d:\CSharp\NH\nhibernate\src\NHibernate\Loader
> > \Loader.cs: line 1583
> > NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor
> > session, QueryParameters queryParameters) in d:\CSharp\NH\nhibernate
> > \src\NHibernate\Hql\Ast\ANTLR\Loader\QueryLoader.cs: line 298
> > NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor
> > session, QueryParameters queryParameters) in d:\CSharp\NH\nhibernate
> > \src\NHibernate\Hql\Ast\ANTLR\QueryTranslatorImpl.cs: line 110
> > NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters
> > queryParameters, ISessionImplementor session, IList results) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Engine\Query\HQLQueryPlan.cs:
> > line 105
> > NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression,
> > QueryParameters queryParameters, IList results) in d:\CSharp\NH
> > \nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 658
> > NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression,
> > QueryParameters parameters) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \Impl\SessionImpl.cs: line 634
> > NHibernate.Impl.ExpressionQueryImpl.List() in d:\CSharp\NH\nhibernate
> > \src\NHibernate\Impl\ExpressionQueryImpl.cs: line 63
> > NHibernate.Linq.NhQueryProvider.ExecuteQuery(NhLinqExpression
> > nhLinqExpression, IQuery query, NhLinqExpression nhQuery) in d:\CSharp
> > \NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs: line 78
> > NHibernate.Linq.NhQueryProvider.Execute(Expression expression) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs: line 27
> > NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression
> > expression) in d:\CSharp\NH\nhibernate\src\NHibernate\Linq
> > \NhQueryProvider.cs: line 102
> > GetEnumerator()
> > ctor(IEnumerable`1 collection)
> > System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

> > logging
> > System.IndexOutOfRangeException: Invalid index 3 for this
> > IfxParameterCollection with Count=3.
> >    at IBM.Data.Informix.IfxParameterCollection.RangeCheck(Int32 index)
> >   at IBM.Data.Informix.IfxParameterCollection.GetParameter(Int32
> > index)
> >   at

> > System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item( > > Int32
> > index)
> >   at NHibernate.Driver.DriverBase.ExpandQueryParameters(IDbCommand
> > cmd, SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \Driver\DriverBase.cs:line 222
> >   at
> > NHibernate.AdoNet.AbstractBatcher.ExpandQueryParameters(IDbCommand
> > cmd, SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \AdoNet\AbstractBatcher.cs:line 227
> >   at NHibernate.Loader.Loader.PrepareQueryCommand(QueryParameters
> > queryParameters, Boolean scroll, ISessionImplementor session) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1185
> >   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
> > QueryParameters queryParameters, Boolean returnProxies) in > > d:\CSharp\NH
> > \nhibernate\src\NHibernate\Loader\Loader.cs:line 399
> >   at

> > NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImp > > lementor
> > session, QueryParameters queryParameters, Boolean returnProxies) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 236
> >   at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
> > QueryParameters queryParameters) in d:\CSharp\NH\nhibernate\src
> > \NHibernate\Loader\Loader.cs:line 1665
> > 3013 [Agent: adapter run thread for test 'TestGetDossiersOpAktieCode'
> > with id '27f9d1cc-00ec-4692-a778-640c7bf90d28'] WARN
> > NHibernate.Util.ADOExceptionReporter (null) -
> > System.IndexOutOfRangeException: Invalid index 3 for this
> > IfxParameterCollection with Count=3.
> >    at IBM.Data.Informix.IfxParameterCollection.RangeCheck(Int32 index)
> >   at IBM.Data.Informix.IfxParameterCollection.GetParameter(Int32
> > index)
> >   at

> > System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item( > > Int32
> > index)
> >   at NHibernate.Driver.DriverBase.ExpandQueryParameters(IDbCommand
> > cmd, SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \Driver\DriverBase.cs:line 222
> >   at
> > NHibernate.AdoNet.AbstractBatcher.ExpandQueryParameters(IDbCommand
> > cmd, SqlString sqlString) in d:\CSharp\NH\nhibernate\src\NHibernate
> > \AdoNet\AbstractBatcher.cs:line 227
> >   at NHibernate.Loader.Loader.PrepareQueryCommand(QueryParameters
> > queryParameters, Boolean scroll, ISessionImplementor session) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1185
> >   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
> > QueryParameters queryParameters, Boolean returnProxies) in > > d:\CSharp\NH
> > \nhibernate\src\NHibernate\Loader\Loader.cs:line 399
> >   at

> > NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImp > > lementor
> > session, QueryParameters queryParameters, Boolean returnProxies) in d:
> > \CSharp\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 236
> >   at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
> > QueryParameters queryParameters) in d:\CSharp\NH\nhibernate\src
> > \NHibernate\Loader\Loader.cs:line 1665
> > 3014 [Agent: adapter run thread for test 'TestGetDossiersOpAktieCode'
> > with id '27f9d1cc-00ec-4692-a778-640c7bf90d28'] ERROR
> > NHibernate.Util.ADOExceptionReporter (null) - Invalid index 3 for this
> > IfxParameterCollection with Count=3.
> > 3015 [Agent: adapter run thread for test 'TestGetDossiersOpAktieCode'
> > with id '27f9d1cc-00ec-4692-a778-640c7bf90d28'] DEBUG
> > NHibernate.Util.ADOExceptionReporter (null) - could not execute query

> > On 14 nov, 14:28, Diego Mijelshon <[email protected]> wrote:
> > > I'm using NH 2.1.2 withInformixand the contrib Linq provider; Take
> > works
> > > fine for me.
> > > What version,

...

read more ยป

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to