Hi, I'm totally new to Spring/hibernate... I would be very grateful If you guys could lend me a hand

Say you have a table "X" and it has a timeStamp(string) and a Value.

What would the query be to access all the records between "date1" and "date2" aggregating the values (AVG) by either, "day,week,month,year" for the past year?

Most Importantly, how do I actually execute the query???

ps. A definite answer would be AWESOME and tutorial Links would be GREAT