Hi,
I have 12 Summary tables(Entities) one for each month txnJan, txnFeb,..and so on.. it has fields like date, transactionCount, location.
Now I have been given a date range as input, I want to get a list of all locations with their transactionCount using Hibernate query.
So,
1) I get months in the range and get the Entity Object List from that..
2) for each Entity Object I do a sum(transactionCount) group by location
3) do a left join of all individual Months and sum (transactionCount) group by Location on All Months..
So I am able to get the locations and sum(transactionCount) for each month in the range
How Do I combine all the individual Month Results
My Code is currently something like this:
Code:
// sTblList- List of Summary Tables (Entity Objects) in given date range
sTblList.each{
def OnemonthMap=it.createCriteria().get {
eq('resource',resourceInstance)
between('date', fromDate, toDate)
projections {
sum(sumCol)
groupProperty(groupCol)
}
}
return sumMap //currently empty -should have combine location and counts for all months
}
please suggest If there is another way to Implement than Criteria API which is more simple .
Thanks in Advance