Hi, I have a problem with this IQuery:
Code:
IQuery consulta = sesion.CreateQuery( "SELECT SUM(m.Importe*m.TipoMovimientoCaja.Signo) FROM MovimientoCaja m WHERE m.Fecha < :Hasta" );
consulta.SetDateTime( "Hasta", hastaFecha );
When I call consulta.List() I get an ADO Exception: (from log)
2005-08-20 11:53:00,641 - [INFO ] NHibernate.Loader.Loader - select SUM(movimien0_.Importe*tipomovi1_.Signo) as x0_0_ from MovimientosCaja movimien0_, TiposMovimientoCaja tipomovi1_ where movimien0_.IDTipoMovimientoCaja=tipomovi1_.IDTipoMovimientoCaja and ((movimien0_.Fecha<@p0))
2005-08-20 11:53:00,651 - [INFO ] NHibernate.Impl.BatcherImpl - Preparing select SUM(movimien0_.Importe*tipomovi1_.Signo) as x0_0_ from MovimientosCaja movimien0_, TiposMovimientoCaja tipomovi1_ where movimien0_.IDTipoMovimientoCaja=tipomovi1_.IDTipoMovimientoCaja and ((movimien0_.Fecha<@p0))
2005-08-20 11:53:01,452 - [ERROR] NHibernate.ADOException - Could not execute query
System.IndexOutOfRangeException: x1_0_
at System.Data.Common.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at NHibernate.Driver.NHybridDataReader.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Hql.QueryTranslator.GetResultColumnOrRow(Object[] row, IDataReader rs, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, IList hydratedObjects, Object optionalObject, Object optionalId, Key[] keys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Hql.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
Somebody can help me?
Thanks