nHibernate Exception - > System.InvalidOperationException: Operation is not valid due to the current state of the object. at Oracle.DataAccess.Client.OracleDataReader.GetOrdinal

48 views
Skip to first unread message

Jorge Luis Tinoco Magaña

unread,
Jun 8, 2016, 3:53:25 PM6/8/16
to NHibernate-Hispano
Hola a todos,me gustaría que me pudieran orientar con el problema que tengo:

Aplicación web MVC 3
.NET framework 4
nHibernate 4.0.0

Tengo la entidad recibos que está relacionado de muchos a uno con la entidad empleados. Y en la aplicación web tengo dos componentes utilizando grids de kendo para consultar los recibos por tipos de recibos. Uno de los grids me debe de regresar un total de más de 3000 recibos. Al tratar de hacer una consulta como la que les presento y que me debe de  regresar los más de 3000 registros me regresa el error que también les anexo en el cuerpo de este mensaje. 
Lo preocupante de este tema es que el error no es consistente, en ocasiones me ha regresado ese error cuando hago la primer carga del grid de kendo , y otras ocasioes hasta la 2da o tercera carga/actualización del grid. 


Receipt result = null;
               
QueryOver<Receipt> queries = QueryOver.Of<Receipt>()
                   
.WhereRestrictionOn(c => c.CreatedDate)
                       
.IsBetween(startDate).And(endDate)
                   
.Where(conjunction)  
                   
.SelectList(list => list
                       
.Select(pr => pr.Uuid).WithAlias(() => result.Uuid)
                       
.Select(pr => pr.Status).WithAlias(() => result.Status)
                       
.Select(pr => pr.Empleado).WithAlias(() => result.Empleado)
                       
.Select(pr => pr.PayrollType).WithAlias(() => result.PayrollType)
                       
.Select(pr => pr.PaymentPeriodStart).WithAlias(() => result.PaymentPeriodStart)
                       
.Select(pr => pr.PaymentPeriodFinish).WithAlias(() => result.PaymentPeriodFinish)
                       
.Select(pr => pr.PayrollPeriod).WithAlias(() => result.PayrollPeriod)
                       
.Select(pr => pr.PaymentDate).WithAlias(() => result.PaymentDate)
                       
.Select(pr => pr.StampingDate).WithAlias(() => result.StampingDate)
                       
.Select(pr => pr.SignedDate).WithAlias(() => result.SignedDate)
                       
.Select(pr => pr.CreatedDate).WithAlias(() => result.CreatedDate) )
                   
.TransformUsing(Transformers.AliasToBean<Receipt>());


                 
BeginTransaction();
               
var resultado = queries.GetExecutableQueryOver(CurrentSession);
               
CommitTransaction();



NHibernate.Exceptions.GenericADOException: could not execute query [ SELECT this_.CFDI_UUID as y0_, this_.REGISTRY_STATUS as y1_, this_.COMPANY_ID as y2_, this_.EMPLOYEE_ID_DBA as y3_, this_.PAYROLL_TYPE as y4_, this_.PAYMENT_PERIOD_INITIAL_DATE as y5_, this_.PAYMENT_PERIOD_FINAL_DATE as y6_, this_.PAYROLL_PERIOD as y7_, this_.PAYMENT_DATE as y8_, this_.FISCAL_STAMPING_DATE as y9_, this_.SIGNED_DATE as y10_, this_.CREATED_DATE as y11_ FROM FEL_PCR_PAYROLL_CFDI_RECEIPT this_ WHERE this_.CREATED_DATE between :p0 and :p1 and (this_.SIGNATURE_MARK = :p2 and this_.PAYROLL_TYPE = :p3 and this_.COMPANY_ID = :p4) ] Name:cp0 - Value:07/06/2016 12:00:00 a.m. Name:cp1 - Value:07/06/2016 11:59:59 p.m. Name:cp2 - Value:N Name:cp3 - Value:3 Name:cp4 - Value:18 [SQL: SELECT this_.CFDI_UUID as y0_, this_.REGISTRY_STATUS as y1_, this_.COMPANY_ID as y2_, this_.EMPLOYEE_ID_DBA as y3_, this_.PAYROLL_TYPE as y4_, this_.PAYMENT_PERIOD_INITIAL_DATE as y5_, this_.PAYMENT_PERIOD_FINAL_DATE as y6_, this_.PAYROLL_PERIOD as y7_, this_.PAYMENT_DATE as y8_, this_.FISCAL_STAMPING_DATE as y9_, this_.SIGNED_DATE as y10_, this_.CREATED_DATE as y11_ FROM FEL_PCR_PAYROLL_CFDI_RECEIPT this_ WHERE this_.CREATED_DATE between :p0 and :p1 and (this_.SIGNATURE_MARK = :p2 and this_.PAYROLL_TYPE = :p3 and this_.COMPANY_ID = :p4)] ---> System.InvalidOperationException: Operation is not valid due to the current state of the object. at Oracle.DataAccess.Client.OracleDataReader.GetOrdinal(String name) at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name, ISessionImplementor session, Object owner) at NHibernate.Loader.Criteria.CriteriaLoader.GetResultRow(Object[] row, IDataReader rs, ISessionImplementor session) at NHibernate.Loader.Criteria.CriteriaLoader.GetResultColumnOrRow(Object[] row, IResultTransformer customResultTransformer, IDataReader rs, ISessionImplementor session) at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer) --- End of inner exception stack trace --- at Tenaris.FEL.DataAccess.Repository`1.ReceiptsWithFilter(String stringCompany, String stringEmployeeId, Dictionary`2 parameters) in D:\TFS\Local\New Features\Development\Tenaris.FEL\Tenaris.FEL.DataAccess\Repository.cs:line 1436 at Tenaris.FrameworkUX.Web.Controllers.ChiefController.ReceiptsFilter(Int32 skip, Int32 take, Int32 page, Int32 pageSize, String stringSignOrigin, String stringPeriod, String stringPayrollType, String stringStartPeriod, String stringEndPeriod, String stringReceiptStatus, String stringCompany, String stringEmployee) in D:\TFS\Local\New Features\Development\Tenaris.FEL\Tenaris.UX.Framework\Controllers\ChiefController.cs:line 739

Employees.hbm.xml
Receipts.hbm.xml

Andrés Falcón

unread,
Jun 14, 2016, 3:22:50 PM6/14/16
to NHibernate-Hispano
Hola Jorge

Como una prueba que haría, sería sacar la proyección sobre empleado. Intentaría buscar sobre que cosa te está tirando error.
Por otro lado, cuando decis "..error es inconsistente..." ¿es inconsistente sobre la misma query (exacta)?

Es lo que se me ocurre probar por ahora.

Saludos,
Andrés Falcón
Reply all
Reply to author
Forward
0 new messages