Hi All,
I need help in writing a simple query. Just not able to do it. I am breaking my head and just don't know how to do this using Criteria.
I have a Project and this project has multiple tasks. I have defined a set for the task.
Code:
<set name="tasks"
cascade="all-delete-orphan"
lazy="true"
inverse="true"
access="field" order-by="CREATED_DATE_ desc">
<key>
<column name="PROJID_" not-null="true"/>
</key>
<one-to-many class="Task"/>
</set>
If it was a sql query then i would have done.
select
project.ID_,
project.NAME_,
project.STARTDATE_,
max(task.DUEDATE_)
from
PROJECT project, TASK task
where
project.id_ = task.PROJID_
group by project.ID_, project.name_, project.startdate_
I am using hibernate 3.1.3. I could do this with a named query but there is no resulttransformer for a Query in 3.1.3 and it is in 3.2. But since 3.2 is still not production ready i would like to do it using a Criteria in version 3.1.3.
Thanks in advance
Prashanth