hql按月分组查询,该如何处理

hql按月分组查询String hql select count(*) from RawCaseRecorder where caseEndTime between +date

hql按月分组查询
String hql = "select count(*) from RawCaseRecorder where caseEndTime between '"+date1+"' and '"+date2+"' and punish_type_1 in('兽药行政处罚','饲料行政处罚') and caseType=3 group by  ";
  list = getHibernateTemplate().find(hql);
我想实现按月分组查询,请问大神我该怎么做,group  by后面的语句我该怎么写?
急,在线等,求指教!

hql 分组查询 按月
[解决办法]
group by to_char(caseEndTime,'mm')
[解决办法]

引用:
Quote: 引用:

group by to_char(caseEndTime,'mm')
日期类型在数据库是保存为long类型的!

TO_DATE('19700101','yyyymmdd') + 
 caseEndTime/86400000 + TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24
这个long转date