tags:

views:

23

answers:

1

Hello,

I have table "Event" and table "Sessions" and each event has a set of sessions and each session has start date and end date.

Event start date : is the start date of first session of that event Event end Date : is the end date of the last session of that event.

what i want to do is return all the events that have start date with entered filters (start - end) using hibernate.

 Criteria eventCriteria = getSession().createCriteria(Event.class);
 eventSessionCriteria = eventCriteria.createCriteria("sessions");
 eventSessionCriteria.add(Expression.ge("startDateAndTime", start));`
 eventSessionCriteria.add(Expression.lt("startDateAndTime", end));

By the previous code : will return the events that have session has start date within entered interval (start - end) which is wrong

I want to do is return the events that have first session(The session that has min start date between all sessions of the event) started within the interval (start - end)

How can i get min session date By using hibernate ?

Thanks in Advance

A: 

Order by startDateAndTime and limit the max number of results to one ?

Samuel_xL