I have MYSQL query
SELECT WEEKDAY(CreatedDate),
COUNT(CreatedDate),
CreatedDate FROM bug_List
GROUP BY
WEEKDAY(CreatedDate)
But I couldn’t find WEEKDAY function in hibernate is there any best way to resolve it
Here i tried from nativeSQL but i got empty array object
query=session.createSQLQuery(“SELECT weekday(CreatedDate),
count(CreatedDate) FROM bug_list GROUP BY WEEKDAY(CreatedDate)”);
result=query.list();
Iterator resultIterator = result.iterator();
while(resultIterator.hasNext())
{
Object[] obj = (Object[]) resultIterator.next();
for (int i = 0; i < obj.length; i++) {
System.out.print(obj[i] + "\t");
}
System.out.println("");
}
WEEKDAYis not standard SQL, and thus if you wish to use Hibernate you must roll a customHibernateDialectin which you do something like the following…As seen here.