Hi all,
I am writing a Tv guide and I have the following object structure. I have a Program class that has a list of episodes and each episode has a list of broadcasts.
Now I want to display a list of episodes beloning to a certain program of which the first broadcast is now later than 2 weeks ago. So I want to get all the episodes that have been aired for the first time in the last 2 weeks.
I have tried using sub queries however no luck getting the right results. I have found the right SQL command with the following:
Code:
select id, (SELECT MIN(startDate) AS minStartDate FROM broadcasts where episode_id=e.id) from episodes e where e.programId=?
This generates a list of episodes of a certain program and the first broadcast airtime for that episode. How can I convert this into a query (HQL or preferably (Detached)Criteria)?
Thanks in advanced,
Martijn