-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Group by month
PostPosted: Mon Aug 06, 2012 11:00 am 
Newbie

Joined: Wed Aug 01, 2012 5:51 am
Posts: 8
Hi !

I'm trying to group my results by month, but according to the standard error monitor it's not coded the way it should be. Do you know what's the origin of the error ?

Here's the request (I get no error before adding the lines after the comment saying "mois") :
Code:
         session = HibernateUtil.currentSession();

         @SuppressWarnings("unchecked")
         Criteria consoLoc = session
         .createCriteria(Circulation.class)
         .createAlias(PROP_NUM_LOC, "loc")
         //conditions
         .add(Expression.isNotNull(PROP_TONNAGE))
         .add(Expression.sql("Conso_elec > (0.005*tonnage)*km"))
         .add(Expression.sql("Conso_elec  < (8 + 0.019*tonnage)*km"))
         .setProjection(
               Projections
               .projectionList()
               .add(proj_somme_elec)
               .add(proj_somme_km)
               .add(proj_somme_tkbrc)
               .add(proj_tonnage_moyen)
               // mois
               .add(Projections.sqlGroupProjection(
                     "month(DhDeparttrain) as month",
                     "month(DhDeparttrain)",
                     new String[]{"month"},
                     new Type[] {Hibernate.DOUBLE})));
         


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.