How can I translate the following query to detachedCriteria:
select * from (
select a.* ,row_number() over (partition by hotel_id order by EXECUTION_START_DATE desc) rnk
from HOLIDAY_PACKAGES a
)
where rnk = 1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think you will be able to construct such a query using the Criteria API. The only way to go is through the Native SQL support or in the worst case scenario use a stored procedure.
http://www.nhforge.org/doc/nh/en/index.html#manipulatingdata-nativesql