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 |