I have a table with the following structure:
ReportId
Version
Title
.....
I want to use HQL to fetch the newest version of the report by id. Would the following query work?
from Report where reportId = :reportId and version = (select max(version) from Report where reportId = :reportId)
Is it possible to retrieve the row with the maximum version without using a sub-select? Is the above sub-select even legal in hibernate HQL?