Discussion:
[nhusers] NHibernate Loader: Could not execute query
Chad A
2017-06-07 17:12:49 UTC
Permalink
I am using NHibernate 4.0..0.4000 and MySql.Data 6.8.3 and am seeing the
following error in my production system from time to time. Everything is
mapped correctly as the query will generally work but somehow the
application gets into this state. This seems to kick off a bunch of
subsequent similar errors (and not to every one on the site). Restarting
the web application seems to fix it. Sometimes for hours, sometimes for
weeks.

I find it interesting that the logged parameter values are out of order, in
this case p4 and p5 values should be switched.

Anyone have thoughts or insight into this?

2017-06-07 14:28:20,725 [18] ERROR [(null)] - Message:could not execute
query
[ SELECT this_.Id as y0_, this_.name as y1_, this_.description as y2_,
this_.areas_of_interest as y3_, this_.type as y4_, this_.tax_id as y5_,
this_.phone_number as y6_, this_.fax_number as y7_, this_.email_address as
y8_, this_.website as y9_, this_.custom_link as y10_,
this_.minimum_funding_range as y11_, this_.maximum_funding_range as y12_,
contactali1_.first_name as y13_, contactali1_.last_name as y14_,
contactali1_.title as y15_, (SELECT count(this_0_.Id) as y0_ FROM
opportunity this_0_ WHERE this_0_.funder_id = this_.Id and (this_0_.status
= ?p0 or this_0_.status = ?p1)) as y16_, (SELECT
sum(this_0_.amount_awarded) as y0_ FROM opportunity this_0_ WHERE
this_0_.funder_id = this_.Id and (this_0_.status = ?p2 or this_0_.status =
?p3)) as y17_, (SELECT count(this_0_.Id) as y0_ FROM opportunity this_0_
WHERE this_0_.funder_id = this_.Id) as y18_ FROM funder this_ left outer
join contact contactali1_ on this_.Id=contactali1_.reference_id and (
contactali1_.is_default = ?p4 ) WHERE this_.organization_id = ?p5 ORDER BY
y1_ asc ]
Name:cp0 - Value:Awarded Name:cp1 - Value:Awarded-Closed Name:cp2 -
Value:Awarded Name:cp3 - Value:Awarded-Closed Name:cp4 -
Value:1b6780ea-62ff-40c6-9d74-a73f010e1e9e Name:cp5 - Value:True
[SQL: SELECT this_.Id as y0_, this_.name as y1_, this_.description as y2_,
this_.areas_of_interest as y3_, this_.type as y4_, this_.tax_id as y5_,
this_.phone_number as y6_, this_.fax_number as y7_, this_.email_address as
y8_, this_.website as y9_, this_.custom_link as y10_,
this_.minimum_funding_range as y11_, this_.maximum_funding_range as y12_,
contactali1_.first_name as y13_, contactali1_.last_name as y14_,
contactali1_.title as y15_, (SELECT count(this_0_.Id) as y0_ FROM
opportunity this_0_ WHERE this_0_.funder_id = this_.Id and (this_0_.status
= ?p0 or this_0_.status = ?p1)) as y16_, (SELECT
sum(this_0_.amount_awarded) as y0_ FROM opportunity this_0_ WHERE
this_0_.funder_id = this_.Id and (this_0_.status = ?p2 or this_0_.status =
?p3)) as y17_, (SELECT count(this_0_.Id) as y0_ FROM opportunity this_0_
WHERE this_0_.funder_id = this_.Id) as y18_ FROM funder this_ left outer
join contact contactali1_ on this_.Id=contactali1_.reference_id and (
contactali1_.is_default = ?p4 ) WHERE this_.organization_id = ?p5 ORDER BY
y1_ asc];StackTrace: at
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List[T]()
at FunderRequestHandler.Handle(ListFundersQuery query) in
QueryHandlers\FunderRequestHandler.cs:line 59
at Controllers.FundersController.Index() in
Controllers\FundersController.cs:line 49
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2
parameters)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult
asyncResult, ExecuteCoreState innerState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult
asyncResult, ProcessRequestState innerState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously);InnerException:Could not find specified column in
results: y0_

Here is what shows up in the NHibernate.log

2017-06-07 14:28:20,694 NHibernate.Util.ADOExceptionReporter WARN -
System.IndexOutOfRangeException: Could not find specified column in
results: y0_
at MySql.Data.MySqlClient.ResultSet.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
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.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)
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Branko L
2018-06-20 15:51:26 UTC
Permalink
Hi Chad,

Did you ever find the solution to this? I have the same problem appearing
from time to time that you describe with the same exception. Using
NHIbernate 4.0.0.4000 and MySql.Data 6.9.8
Post by Chad A
I am using NHibernate 4.0..0.4000 and MySql.Data 6.8.3 and am seeing the
following error in my production system from time to time. Everything is
mapped correctly as the query will generally work but somehow the
application gets into this state. This seems to kick off a bunch of
subsequent similar errors (and not to every one on the site). Restarting
the web application seems to fix it. Sometimes for hours, sometimes for
weeks.
I find it interesting that the logged parameter values are out of order,
in this case p4 and p5 values should be switched.
Anyone have thoughts or insight into this?
2017-06-07 14:28:20,725 [18] ERROR [(null)] - Message:could not execute
query
[ SELECT this_.Id as y0_, this_.name as y1_, this_.description as y2_,
this_.areas_of_interest as y3_, this_.type as y4_, this_.tax_id as y5_,
this_.phone_number as y6_, this_.fax_number as y7_, this_.email_address as
y8_, this_.website as y9_, this_.custom_link as y10_,
this_.minimum_funding_range as y11_, this_.maximum_funding_range as y12_,
contactali1_.first_name as y13_, contactali1_.last_name as y14_,
contactali1_.title as y15_, (SELECT count(this_0_.Id) as y0_ FROM
opportunity this_0_ WHERE this_0_.funder_id = this_.Id and (this_0_.status
= ?p0 or this_0_.status = ?p1)) as y16_, (SELECT
sum(this_0_.amount_awarded) as y0_ FROM opportunity this_0_ WHERE
this_0_.funder_id = this_.Id and (this_0_.status = ?p2 or this_0_.status =
?p3)) as y17_, (SELECT count(this_0_.Id) as y0_ FROM opportunity this_0_
WHERE this_0_.funder_id = this_.Id) as y18_ FROM funder this_ left outer
join contact contactali1_ on this_.Id=contactali1_.reference_id and (
contactali1_.is_default = ?p4 ) WHERE this_.organization_id = ?p5 ORDER BY
y1_ asc ]
Name:cp0 - Value:Awarded Name:cp1 - Value:Awarded-Closed Name:cp2 -
Value:Awarded Name:cp3 - Value:Awarded-Closed Name:cp4 -
Value:1b6780ea-62ff-40c6-9d74-a73f010e1e9e Name:cp5 - Value:True
[SQL: SELECT this_.Id as y0_, this_.name as y1_, this_.description as y2_,
this_.areas_of_interest as y3_, this_.type as y4_, this_.tax_id as y5_,
this_.phone_number as y6_, this_.fax_number as y7_, this_.email_address as
y8_, this_.website as y9_, this_.custom_link as y10_,
this_.minimum_funding_range as y11_, this_.maximum_funding_range as y12_,
contactali1_.first_name as y13_, contactali1_.last_name as y14_,
contactali1_.title as y15_, (SELECT count(this_0_.Id) as y0_ FROM
opportunity this_0_ WHERE this_0_.funder_id = this_.Id and (this_0_.status
= ?p0 or this_0_.status = ?p1)) as y16_, (SELECT
sum(this_0_.amount_awarded) as y0_ FROM opportunity this_0_ WHERE
this_0_.funder_id = this_.Id and (this_0_.status = ?p2 or this_0_.status =
?p3)) as y17_, (SELECT count(this_0_.Id) as y0_ FROM opportunity this_0_
WHERE this_0_.funder_id = this_.Id) as y18_ FROM funder this_ left outer
join contact contactali1_ on this_.Id=contactali1_.reference_id and (
contactali1_.is_default = ?p4 ) WHERE this_.organization_id = ?p5 ORDER BY
y1_ asc];StackTrace: at
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List[T]()
at FunderRequestHandler.Handle(ListFundersQuery query) in
QueryHandlers\FunderRequestHandler.cs:line 59
at Controllers.FundersController.Index() in
Controllers\FundersController.cs:line 49
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2
parameters)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult
asyncResult, ExecuteCoreState innerState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult
asyncResult, ProcessRequestState innerState)
at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously);InnerException:Could not find specified column in
results: y0_
Here is what shows up in the NHibernate.log
2017-06-07 14:28:20,694 NHibernate.Util.ADOExceptionReporter WARN -
System.IndexOutOfRangeException: Could not find specified column in
results: y0_
at MySql.Data.MySqlClient.ResultSet.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
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.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)
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Loading...