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: HQL help
PostPosted: Wed Dec 29, 2004 5:21 pm 
Can someone help me combine these two queryies into one (posibley using HQL. Currently I am processing the 2 queries and then combining them manualy.

Thanks

Hibernate version:
2.1.6
Mapping documents:

Code between sessionFactory.openSession() and session.close():
List buildSummary = s.createQuery(
"select new org.tiaa.cbi.ProjectStats( "
+ "week(builditem.timestamp), "
+ "builditem.project.projectName, " + "count(*), "
+ "builditem.loc, " + "builditem.numClasses, "
+ "builditem.numUnitTests, "
+ "sum(builditem.scoreCard), "
+ "builditem.timestamp) " + "from "
+ "BuildItem as builditem " + "group by "
+ "week(builditem.timestamp) , "
+ "builditem.project.id").list();

List buildDetail = s
.createQuery(
"select new org.tiaa.cbi.ProjectStats( "
+ "week(builditem.timestamp), "
+ "builditem.project.projectName, "
+ "count(*), "
+ "builditem.loc, "
+ "builditem.numClasses, "
+ "builditem.numUnitTests, "
+ "sum(builditem.scoreCard), "
+ "builditem.timestamp) "
+ "from "
+ "BuildItem as builditem "
+ "where builditem.id = (select max(build.id) from BuildItem as build where builditem.project = build.project and week(build.timestamp) = week(builditem.timestamp) )"
+ "group by "
+ "week(builditem.timestamp) , "
+ "builditem.project.id").list();

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Mysql 4.1
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
  
 
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.