0

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
Anat
  • 143
  • 2
  • 8

1 Answers1

0

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

MonkeyCoder
  • 2,600
  • 2
  • 28
  • 30