NotAnXpert
2010-09-02 22:31:10 UTC
My goal is to invoke coalesce operator in select statement "order by"
clause using NHibernate Criteria API.
Does the API support coalesce function? Reason being I tried the
following snippet but it did not yield the desired results. In fact I
could not see the coalesce operator in the resulting sql using
NHibernate profiler.
var projectionList = Projections.ProjectionList();
projectionList.Add(Projections.Property("Column1"));
projectionList.Add(Projections.Property("Column2"));
var result = Projections.SqlFunction("coalesce",
NHibernateUtil.String, projectionList);
I am performing a complex join involving over 7 tables and I am
interested in sorting the result set by 2 columns (one of which could
be null; hence the coalesce)
I'd seen a lot of examples on which involves invoking SQL functions
such as Year, Month etc but not with coalesce.
Any pointers on how to go about with it?
clause using NHibernate Criteria API.
Does the API support coalesce function? Reason being I tried the
following snippet but it did not yield the desired results. In fact I
could not see the coalesce operator in the resulting sql using
NHibernate profiler.
var projectionList = Projections.ProjectionList();
projectionList.Add(Projections.Property("Column1"));
projectionList.Add(Projections.Property("Column2"));
var result = Projections.SqlFunction("coalesce",
NHibernateUtil.String, projectionList);
I am performing a complex join involving over 7 tables and I am
interested in sorting the result set by 2 columns (one of which could
be null; hence the coalesce)
I'd seen a lot of examples on which involves invoking SQL functions
such as Year, Month etc but not with coalesce.
Any pointers on how to go about with it?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.