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:
|