Description
Environment
None
Attachments
2
- 06 Mar 2010, 02:39 AM
Activity
Show:
Alex Zaytsev September 8, 2020 at 9:22 PM
Moved here.
Andrey Kozhyn April 13, 2012 at 6:53 AM
Same in 3.3.0CR1. Added a new test case for new version
Alex Zaytsev April 12, 2012 at 3:58 PM
Could you please check with NH 3.3.0CR1?
Andrey Kozhyn April 12, 2012 at 2:14 PM
Here is a test case for this issue
Won't Fix
Pinned fields
Click on the next to a field label to start pinning.
Details
Assignee
Reporter
Components
Fix versions
Affects versions
Priority
Minor
Who's Looking?
Open Who's Looking?
Created March 6, 2010 at 2:39 AM
Updated July 25, 2012 at 5:54 AM
Resolved December 24, 2010 at 4:51 PM
Who's Looking?
Sample code:
q1 = from t in session.Query<Account>() select t;
sum = q1.Sum<Account>(p => p.Balance);
crashes when there are no rows in the table.
Old equivalent code:
query = session.CreateQuery("select Sum(a.Balance) from Account a");
sum = query.UniqueResult<decimal>();
behaves correctly - it returns 0.
Stack trace:
NHibernate.Exceptions.GenericADOException was unhandled
Message="Could not execute query[SQL: SQL not available]"
Source="NHibernate"
SqlString="SQL not available"
StackTrace:
w NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
w NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)
w NHibernate.Impl.ExpressionQueryImpl.List()
w NHibernate.Linq.NhQueryProvider.Execute(Expression expression)
w NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression expression)
w System.Linq.Queryable.Sum[TSource](IQueryable`1 source, Expression`1 selector)
w NHLinqSum.Program.Main(String[] args) w D:\projekty\NHLinqSum\NHLinqSum\Program.cs:wiersz 56
w System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
w System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
w Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
w System.Threading.ThreadHelper.ThreadStart_Context(Object state)
w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
w System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentException
Message="Wartość „" nie jest typu „System.Decimal" i nie może być użyta w tej kolekcji rodzajowej.\r\nNazwa parametru: value"
Source="mscorlib"
ParamName="value"
StackTrace:
w System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType)
w System.Collections.Generic.List`1.VerifyValueType(Object value)
w System.Collections.Generic.List`1.System.Collections.IList.Add(Object item)
w NHibernate.Util.ArrayHelper.AddAll(IList to, IList from)
w NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
w NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
InnerException: