Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

[NHibernate-development] [NH] Ability to use Aggregate Projections
 on Projections [NH-1393]

Tuna Toksöz

2008-07-22


Author LoginPost Reply
Hello everybody,

The issue is here

http://jira.nhibernate.org/browse/NH-1393

Basically, the problem is we cannot do following

        [Test]
        public void CanAvgProjectionOnSqlFunction()
        {
            using (ISession s = OpenSession())
            {
                ISQLFunction arithmaticAddition = new VarArgsSQLFunction("(", "+", ")");
                ICriteria c = s.CreateCriteria(typeof(Person))
                    .SetProjection(
                    Projections.Avg(Projections.SqlFunction(arithmaticAddition,
                                                            NHibernateUtil.GuessType(typeof(double)),
                                                            Projections.Property("IQ"),
                                                            Projections.Property("ShoeSize"))));
                IList list = c.List();
                Assert.AreEqual( 334/5,list[0]);
            }
        }

What I want to ask is, should I go for SqlFunction projections, or any projection. Projection is not error-safe, I mean user may try to aggregate on Subquery projection, which is illegal in MSSQL(and probably the others.
So my question is, Should I go for Projection or restrict it to SqlFunctionProjection.


--
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
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.