From: xelibrion (JIRA) <nh...@gm...> - 2011-04-05 08:58:42
|
MultiCriteria does not work with criteria created using JoinQueryOver --------------------------------------------------------------------- Key: NH-2624 URL: http://216.121.112.228/browse/NH-2624 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 3.1.0 Reporter: xelibrion Priority: Critical I've got exception System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 in code var queryOver = Session.QueryOver<Post>() .Fetch(x => x.Author).Eager .Fetch(x => x.Blog).Eager .JoinQueryOver(x => x.SearchRequests) .Where(x => x.Id == context.SearchRequestId) .TransformUsing(Transformers.DistinctRootEntity) .Skip(context.PageIndex*pageSize) .Take(pageSize); Session.CreateMultiCriteria() .Add(queryOver.UnderlyingCriteria) .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) .List(); I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Richard B. (JIRA) <nh...@gm...> - 2011-04-06 15:09:41
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Richard Brown reassigned NH-2624: --------------------------------- Assignee: Richard Brown > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Critical > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-04-07 19:11:49
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-2624: ---------------------------- Priority: Minor (was: Critical) > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Richard B. (JIRA) <nh...@gm...> - 2011-04-27 14:13:10
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20978#action_20978 ] Richard Brown commented on NH-2624: ----------------------------------- Hi, There is an overload on the IMultiCriteria that takes an IQueryOver, so I would expect the following to work: Session.CreateMultiCriteria() .Add(queryOver) .Add(queryOver.ToRowCountQuery()) .List(); Alternatively, all that does behind the scenes is grab the 'root' criteria, so the following should also work: Session.CreateMultiCriteria() .Add(queryOver.RootCriteria) // not UnderlyingCriteria .Add(queryOver.ToRowCountQuery().RootCriteria) .List(); Can you let me know if that helps? Cheers, Richard > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: xelibrion (JIRA) <nh...@gm...> - 2011-04-27 14:31:26
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20979#action_20979 ] xelibrion commented on NH-2624: ------------------------------- >Can you let me know if that helps? Sure. Overload with IQueryOver does not work for me, i've got System.ArgumentException: The value "2" is not of type "BlogAnalysis.DomainModel.Entities.Post" and cannot be used in this generic collection. Parameter name: value but second option works fine > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Richard B. (JIRA) <nh...@gm...> - 2011-04-27 16:13:13
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20980#action_20980 ] Richard Brown commented on NH-2624: ----------------------------------- Ahh, my mistake. I think the syntax is: Session.CreateMultiCriteria() .Add(queryOver) .Add<int>(queryOver.ToRowCountQuery()) .List(); (note the explicit type to be returned in the second query) Also, you can do this with Futures: var results = queryOver.Future(); var resultsCount = queryOver.ToRowCountQuery().FutureValue<int>().Value; > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: xelibrion (JIRA) <nh...@gm...> - 2011-05-01 15:06:55
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20988#action_20988 ] xelibrion commented on NH-2624: ------------------------------- Okay, thank you for this information > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Richard B. (JIRA) <nh...@gm...> - 2011-05-01 18:31:47
|
[ http://216.121.112.228/browse/NH-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Richard Brown closed NH-2624. ----------------------------- Resolution: Not an Issue > MultiCriteria does not work with criteria created using JoinQueryOver > --------------------------------------------------------------------- > > Key: NH-2624 > URL: http://216.121.112.228/browse/NH-2624 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: xelibrion > Assignee: Richard Brown > Priority: Minor > > I've got exception > System.InvalidCastException: Unable to cast object of type 'Subcriteria' to type 'NHibernate.Impl.CriteriaImpl'. > at NHibernate.Impl.MultiCriteriaImpl.CreateCriteriaLoaders() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 287 > at NHibernate.Impl.MultiCriteriaImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiCriteriaImpl.cs:line 73 > in code > var queryOver = Session.QueryOver<Post>() > .Fetch(x => x.Author).Eager > .Fetch(x => x.Blog).Eager > .JoinQueryOver(x => x.SearchRequests) > .Where(x => x.Id == context.SearchRequestId) > .TransformUsing(Transformers.DistinctRootEntity) > .Skip(context.PageIndex*pageSize) > .Take(pageSize); > Session.CreateMultiCriteria() > .Add(queryOver.UnderlyingCriteria) > .Add(queryOver.ToRowCountQuery().UnderlyingCriteria) > .List(); > I've found workaround using JoinAlias -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |