Hi,
I would like some help with a Hibernate Query. To provide some background, I have a SQL Server database table, called X_COUNTS, that looks like this...
Code:
state_change_time picks_complete storeid
2015-06-30 16:25:43.0 325 8953
2015-06-30 14:37:32.0 289 8953
I have built the SQL Server query that returns the results that I am after...
Code:
SELECT DATEPART(HOUR, state_change_time) AS HR, SUM(picks_complete) AS ITEMS_PICKED
FROM DBO.X_COUNTS
WHERE storeid = '8953'
GROUP BY DATEPART(HOUR, state_change_time);
What I am having a big struggle with is how to translate this into HQL - obviously the result from my query does not map to the Bean I have used to model the X_COUNTS table. What I have been trying is something like...
Code:
// Retrieve session from Hibernate
Session session = sessionFactory.getCurrentSession();
Query query = session.createQuery(<HOW_DO_I_DO_THIS_QUERY_PLEASE?>);
Any advice, example queries would be very helpful - I haven't found anything that quite matches what I am after on the forums, online tutorials etc
Thank you