Convert Sql to Hql

I am trying to write below sql query in hibernate hql. I am using oracle database.

SELECT distinct u.user_id,u.user_name FROM (select abcId, max(upload_date) upload_date, user_id from ABC GROUP BY abcId, user_id) abc,users u WHERE abc.user_id=u.user_id 

I struggled to write it in hql. Unfortunately, I could not succeed. Can someone shed some light on me to achieve this in hql?

+4
source share
1 answer

I think session.createSQLQuery(String sqlQuery) might work for you ... see example here

+4
source

Source: https://habr.com/ru/post/1388591/


All Articles