From: Kelly S. (JIRA) <nh...@gm...> - 2011-05-04 18:49:56
|
Linq Select() broken with .ToFuture() ------------------------------------- Key: NH-2690 URL: http://216.121.112.228/browse/NH-2690 Project: NHibernate Issue Type: Bug Components: Linq Provider Affects Versions: 3.1.0 Reporter: Kelly Stuard Priority: Major //Given the following: var query = from cat in session.Query<Cat>() select new { Id = cat.Id, Name = cat.Name, }; //This works: var result1 = query.ToList(); //But this does not: var queryResults = query.ToFuture().ToList(); Exception: NHibernate.HibernateException was unhandled Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; ] Source=NHibernate StackTrace: at NHibernate.Impl.MultiQueryImpl.DoList() at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() at NHibernate.Impl.MultiQueryImpl.List() at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) at NHibernate.Impl.FutureBatch`2.GetResults() at NHibernate.Impl.FutureBatch`2.get_Results() at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.ArgumentException Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. Parameter name: value Source=mscorlib ParamName=value StackTrace: at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) at NHibernate.Impl.MultiQueryImpl.DoList() InnerException: This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. I will attach test cases used to generate this exception, shortly. -- 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: Kelly S. (JIRA) <nh...@gm...> - 2011-05-04 18:56:54
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kelly Stuard updated NH-2690: ----------------------------- Attachment: NH2690.zip This is my first test case. I believe I followed the directions, correctly. Please let me know if I missed something or if I can provide additional information. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-10 14:57:59
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21033#action_21033 ] Andrei Alecu commented on NH-2690: ---------------------------------- Same error seems to happen with ToFuture() and .Fetch/.FetchMany even if the type being selected is the same as the underlaying entity (and not anonymous). Definitely a show stopper. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Kelly S. (JIRA) <nh...@gm...> - 2011-05-10 17:31:57
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21035#action_21035 ] Kelly Stuard commented on NH-2690: ---------------------------------- Andrei, As I mentioned above, I'm able to do the following, with no error: var query = from cat in session.Query<Cat>() select cat; var queryResults = query.ToFuture().ToList(); If you are having trouble without anonymous projection, please paste in your complete LINQ statement(s); and, if it's the same base issue, I'll be happy to produce a failing unit test [to add to the one I've already uploaded]. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-10 17:35:58
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21036#action_21036 ] Andrei Alecu commented on NH-2690: ---------------------------------- I haven't tried your unit test yet, but if you had a property in Cat that associates a different table, then you could try seeing if: var query = (from cat in session.Query<Cat>() select cat).Fetch(p=>p.Property); works. I haven't had time to exactly pin point where the problem is, but I believe it is related to Fetch (or) FetchMany. We have reverted our code to not use ToFuture() for now. But I will get back to this soon. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Kelly S. (JIRA) <nh...@gm...> - 2011-05-10 18:29:55
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21039#action_21039 ] Kelly Stuard commented on NH-2690: ---------------------------------- Ahh. I ran what you are talking about and got this: System.NotSupportedException was unhandled by user code Message=You can also use the AsFuture() method on NhQueryable I believe that is this issue, exactly: http://216.121.112.228/browse/NH-2422 If anyone who knows what they are doing reads this, I'm now watching HN-2242 and will be happy to produce a test for this, if needed/desired. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Vasile B. (JIRA) <nh...@gm...> - 2011-05-10 18:33:57
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21041#action_21041 ] Vasile Bujac commented on NH-2690: ---------------------------------- The combination of .ToFuture() and .Fetch(p => p.Related) doesn't work because the .Fetch() returns a NhFetchRequest<T> (derived from QuerableBase<T>) and .ToFuture() expects a NhQueryable<T> (also derived from QueryableBase<T>) - a cast is performed when calling .ToFuture(). This is a distinct problem, I think there is a related issue NH-2422 (http://216.121.112.228/browse/NH-2422). I've also run into the "projection and .ToFuture() problem", it is definetely a show stopper. Also I've experienced a similar bug when using .ToFuture() and another type of projection using AliasToBeanTransformer of predefined classes on hql query api (i think it says it was resolved, but nevertheless I've run into this problem with NH 3.1) > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 10:59:03
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21048#action_21048 ] Andrei Alecu commented on NH-2690: ---------------------------------- Oh, sorry for misleading you. I remember now that I made a custom .ToFuture() that casts to QueryableBase<T> instead of NhQueryable<T> and attempted to use that. Simply try to put this inside some ToFutureExtensions class: public static IEnumerable<T> ToFuture2<T>(this IQueryable<T> query) { var nhQueryable = query as QueryableBase<T>; if (nhQueryable == null) throw new NotSupportedException("You can also use the AsFuture() method on NhQueryable"); var future = ((NhQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression); return (IEnumerable<T>)future; } And then call ToFuture2(). You will then probably see the same error you were originally getting. I believe that if this particular bug is fixed, then the ToFuture() with Fetch() will work as well. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 11:13:03
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21050#action_21050 ] Andrei Alecu commented on NH-2690: ---------------------------------- Also, something else to test would be to try multiple calls to ToFuture() instead of just one. I believe this escalates to a MultiQuery and might result in the same error, even if you're selecting to Cat. Something like: var cat1 = Session.Query<Cat>().Where(p=>p.Id = 1).ToFuture(); var cat2 = Session.Query<Cat>().Where(p=>p.Id = 2).ToFuture(); var cats = cat1.Concat(cat2).ToList(); > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 13:24:03
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21052#action_21052 ] Andrei Alecu commented on NH-2690: ---------------------------------- Ok, I had a little bit of free time on my hands so I grabbed the NHibernate source and was able to fix both bugs (NH-2690 and NH-2422). I added a bunch of tests and verified that all other tests still pass. I will submit a patch soon. (unfortunately I didn't grab the source via SVN initially so getting the .patch file out is going to be a pain) > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Steve B. (JIRA) <nh...@gm...> - 2011-05-11 13:32:02
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21053#action_21053 ] Steve Bohlen commented on NH-2690: ---------------------------------- Applying your changes to the trunk in order to create a patch isn't that hard -- just do the following and you should be fine: 1) checkout source from SVN into a completely new folder location 2) copy the entire source tree in which you made your edits to the clipboard 3) paste it into the checked-out folder hierarchy, selecting OVERWRITE/REPLACE as the method to resolve file/folder conflicts 4) build your patch based on the resultant source (after you verify that it still all builds/tests pass of course) Step #3 will properly integrate your changes into the checked-out source from SVN. Let us know if you have any troubles with this approach. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 14:07:53
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei Alecu updated NH-2690: ----------------------------- Attachment: nh2690 nh2422 nh2421.patch Attached patch which resolves NH-2690 NH-2421 and NH-2422 > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Kelly S. (JIRA) <nh...@gm...> - 2011-05-12 14:53:14
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21062#action_21062 ] Kelly Stuard commented on NH-2690: ---------------------------------- That is a very small change with such wonderful impact. Here'e to hoping it's easy to review and get into the trunk. Thank you, Andrei. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Major > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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-05-12 16:21:42
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo reassigned NH-2690: ------------------------------- Assignee: Fabio Maulo > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Assignee: Fabio Maulo > Priority: Major > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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-05-12 16:27:56
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo resolved NH-2690. ----------------------------- Resolution: Fixed Fix Version/s: 3.2.0Beta1 > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Assignee: Fabio Maulo > Priority: Major > Fix For: 3.2.0Beta1 > > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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: Kelly S. (JIRA) <nh...@gm...> - 2011-05-12 17:49:10
|
[ http://216.121.112.228/browse/NH-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21063#action_21063 ] Kelly Stuard commented on NH-2690: ---------------------------------- Big thanks to all who touched this. This allows for all sorts of performance improvements. > Linq Select() broken with .ToFuture() > ------------------------------------- > > Key: NH-2690 > URL: http://216.121.112.228/browse/NH-2690 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Assignee: Fabio Maulo > Priority: Major > Fix For: 3.2.0Beta1 > > Attachments: nh2690 nh2422 nh2421.patch, NH2690.zip > > > //Given the following: > var query = > from cat in session.Query<Cat>() > select new > { > Id = cat.Id, > Name = cat.Name, > }; > //This works: > var result1 = query.ToList(); > //But this does not: > var queryResults = query.ToFuture().ToList(); > Exception: > NHibernate.HibernateException was unhandled > Message=Failed to execute multi query: [select cat0_.Id as col_0_0_, cat0_.Name as col_1_0_ from Cat cat0_; > ] > Source=NHibernate > StackTrace: > at NHibernate.Impl.MultiQueryImpl.DoList() > at NHibernate.Impl.MultiQueryImpl.ListIgnoreQueryCache() > at NHibernate.Impl.MultiQueryImpl.List() > at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) > at NHibernate.Impl.FutureBatch`2.GetResults() > at NHibernate.Impl.FutureBatch`2.get_Results() > at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) > at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() > at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > at NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeAbleToFutureSelectOntoAnonymous() in C:\Users\kstuard\Desktop\NH2540\NHibernate.Test\NHSpecificTest\NH1234\SampleTest.cs:line 97 > at ConsoleApplication2.Program.Main(String[] args) in C:\Users\kstuard\Desktop\NH2540\ConsoleApplication2\Program.cs:line 16 > at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) > at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) > at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) > at System.Threading.ThreadHelper.ThreadStart() > InnerException: System.ArgumentException > Message=The value "System.Object[]" is not of type "<>f__AnonymousType0`2[System.Int32,System.String]" and cannot be used in this generic collection. > Parameter name: value > Source=mscorlib > ParamName=value > StackTrace: > at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType) > at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item) > at NHibernate.Impl.MultiQueryImpl.DoList() > InnerException: > This works fine if I select directly to typeof(Cat). Future is such a wonderful tool; it would be great if it worked in this scenario. > I will attach test cases used to generate this exception, shortly. -- 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 |