Hibernate version: 3.2.3
Mapping documents:
Code:
<hibernate-mapping>
<class name="myPackage.ProductGroup" table="radProductGroup">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="version" column="versionx"/>
<many-to-one name="document" class="myPackage.Document"/>
<property name="productGroupId"/>
<property name="xml"/>
<property name="created"/>
</class>
</hibernate-mapping>
i would need the HQL to get for each 'productGroupId' (it is just an Integer value) prepresented in the table, the most recent record ('created' is a date).
in SQL i get the right results by using this query
Code:
SELECT x.* FROM (SELECT * FROM radProductGroup ORDER BY created DESC) x GROUP BY x.productGroupId;
what would be the way to do this in HQL ?