Is there a way to use sql-server like analytic functions in Hibernate?
Something like
select foo from Foo foo where f.x = max(f.x) over (partition by f
Another approach would be to use the mapping. Please see this article: https://forums.hibernate.org/viewtopic.php?f=1&t=998482
I am against the usage of native SQL queries in Hibernate... you lose the benefits of having a mapping:-)