NH3 branch - Unable to perform find[SQL: SQL not available]

Topics: Core, Installing Orchard, Troubleshooting
Jul 19, 2012 at 10:26 AM

Have setup a fresh install using the NH3 branch and am hitting the following error when going to Content in the Admin UI:

Oops. Something went wrong ... sorry

An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back

Unable to perform find[SQL: SQL not available]

NHibernate.Exceptions.GenericADOException: Unable to perform find[SQL: SQL not available] ---> System.ArgumentException: The value "1" is not of type "Orchard.ContentManagement.Records.ContentItemVersionRecord" and cannot be used in this generic collection. Parameter name: value at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) at NHibernate.Util.ArrayHelper.AddAll(IList to, IList from) at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) --- End of inner exception stack trace --- at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) at NHibernate.Impl.CriteriaImpl.List(IList results) at NHibernate.Impl.CriteriaImpl.List[T]() at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery.Slice(Int32 skip, Int32 count) in C:\Development\orchard_nh3\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 198 at Orchard.Core.Contents.Controllers.AdminController.List(ListContentsViewModel model, PagerParameters pagerParameters) in C:\Development\orchard_nh3\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 91 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.ControllerActionInvoker.<>c__DisplayClass15.b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

I am getting a similar error when I visit the Comments and Queries pages:

Oops. Something went wrong ... sorry

An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back

could not execute query [ SELECT TOP (@p0) count(*) as y0_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Orchard_Comments_CommentPartRecord commentpar2_ on contentite1_.Id=commentpar2_.Id WHERE this_.Published = @p1 and this_.Published = @p2 ORDER BY commentpar2_.CommentDateUtc desc ] Name:cp0 - Value:True Name:cp1 - Value:True [SQL: SELECT TOP (@p0) count(*) as y0_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Orchard_Comments_CommentPartRecord commentpar2_ on contentite1_.Id=commentpar2_.Id WHERE this_.Published = @p1 and this_.Published = @p2 ORDER BY commentpar2_.CommentDateUtc desc]

NHibernate.Exceptions.GenericADOException: could not execute query [ SELECT TOP (@p0) count(*) as y0_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Orchard_Comments_CommentPartRecord commentpar2_ on contentite1_.Id=commentpar2_.Id WHERE this_.Published = @p1 and this_.Published = @p2 ORDER BY commentpar2_.CommentDateUtc desc ] Name:cp0 - Value:True Name:cp1 - Value:True [SQL: SELECT TOP (@p0) count(*) as y0_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Orchard_Comments_CommentPartRecord commentpar2_ on contentite1_.Id=commentpar2_.Id WHERE this_.Published = @p1 and this_.Published = @p2 ORDER BY commentpar2_.CommentDateUtc desc] ---> System.Data.SqlClient.SqlException: Column "Orchard_Comments_CommentPartRecord.CommentDateUtc" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) --- End of inner exception stack trace --- at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) at NHibernate.Impl.CriteriaImpl.List(IList results) at NHibernate.Impl.CriteriaImpl.List[T]() at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery.Slice(Int32 skip, Int32 count) in C:\Development\orchard_nh3\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 198 at Orchard.Comments.Controllers.AdminController.Index(CommentIndexOptions options, PagerParameters pagerParameters) 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.ControllerActionInvoker.<>c__DisplayClass15.b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

The content picker also throws a similar error.

I have successfully created a page, blog, layer, menu, tag.

I have tried with both SQL Server and SQL Server Compact.

Any ideas?  Anyone else come across this?

Jeff 

Jul 19, 2012 at 3:05 PM

I'm having the same problem but i think the NH3 branch is only for testing and dev purposes till 1.6 is released with upgrade NHibernate, but i'm just guessing that.

Jul 19, 2012 at 4:45 PM

Yeah I think you are correct.  

I am just testing out a couple of custom modules and some tweaks to Projections and wanted to check I wasn't experiencing something unusual as I thought Sébastien had mentioned that the core stuff was working in the NH3 branch.

Aug 22, 2012 at 10:48 AM

This seems to be fixed in the latest 1.x