[NH-1380] Implementing subquery in from clause of a (detached)criteria.

"Tuna Toksöz" <[email protected]> Tue, 22 Jul 2008 18:34:30 +0300
Newsgroups gmane.comp.windows.dotnet.nhibernate.devel
Message-ID <[email protected]>
Hello,
In our linq-to-nhibernate implementation, we're using Criteria api and we're
trying to improve criteria api when it lacks of some ability we need.

This issue(NH1380) is one of the features that we depend on for some cases.
This include cases like nested queries, or Chained skip & take operations(
http://jira.nhibernate.org/browse/NHLQ-1) and some others.

I will be spending some time on it, and plan to create patch if I can get
something working.

This feature will require modification to both criteria and
detachedcriteria.

What I plan to end up with is that

DetachedCriteria innerClause=DetachedCriteria.For<Person>();
innerClause.AddOrder(Order.Asc("PersonName"));
innerClause.SetMaxResults(10);
innerClause.SetFirstResult(4);
innerClause.SetProjection(Projections.ProjectionList().Add(Projections.Property("Name"));

DetachedCriteria innerClause2=DetachedCriteria.AboveSubquery(innerClause);
innerClause2.SetMaxResults(3);
innerClause2.SetMaxResults(5);

ICriteria criteria=innerClause2.GetExecutableCriteria(session);
IList results=criteria.List();

Is that a good end result? Should I go for Criteria one instead of
DetachedCriteria?

And I really wonder how much refactor this will need because not sure if it
is too much for me.

And maybe somebody could do it before me, i would really appreciate it.


-- 
Tuna Toksöz

Typos included to enhance the reader's attention ...

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development