I'm using Hibernate 3 and I want to write HQL to group data by month but I have no idea how to do this and would prefer to not use native SQL. Here's an example, if I have this table...
MEMBER
id name registeredDate
1 aaa 05-14-2005 14:03:01
2 bbb 04-19-2003 19:09:16
3 ccc 05-27-2005 08:30:42
4 ddd 11-13-2004 11:59:03
I want to get all the users who have registered within the past 12 months and then a count of those users. I know in HQL I can add a clause like this and registeredDate >= :regDateToTest and just populate "regDateToTest" in java. That would give me those registered dates from the past year. However, I then have to do a bunch of date manipulation and checking inside my action to do the group by piece. I'm wondering if there's simply an easier way to do this but, again, without using native SQL queries.
[/b]
|