I am using NHibernate to query my database using the criteria API. My criteria are below:
ICriteria c = Session.CreateCriteria(typeof(Transaction));
ProjectionList projections = Projections.ProjectionList();
projections.Add(Projections.Sum("Units"), "Units");
projections.Add(Projections.GroupProperty("Account"), "Account");
projections.Add(Projections.GroupProperty("Security"), "Security");
c.SetProjection(projections);
This works fine, but what I would like is to limit the query to only return when the "Units" property is> 0. In SQL, I would simply suggest that I Having Units > 0could not find a way to do this in NHibernate. Anyone have any ideas or my only option for using HQL?
source
share