I need to execute native sqn on nhibernate and get sum from complex query needed for reporting. The sql query returns only one float value for a sum.
float theSum= session.CreateSQLQuery(@"select sum(myfield) myfield from ....")
.AddScalar("myfield", NHibernateUtil.Single)
.UniqueResult<float>();
Is this OK ?
Is there any other way to do this ?
I guess this auto casts null value to 0.