Hello
I have normal master-detail table pair where master table has mapping like this (important snippets):
<hibernate-mapping> <class name="BE" table="be"> ... <property name="stopTimestamp" type="java.util.Date" column="STOP_TS" not-null="false"/> ... <bag name="analysis" cascade="all" order-by="start_ts"> <key column="be_id"/> <one-to-many class="BEAnalysis"/> </bag> ... </class> </hibernate-mapping>
Criteria criteria = session.createCriteria(BE.class); ... criteria.addOrder(Order.asc("stopTimestamp")); criteria.setFetchMode("analysis", FetchMode.JOIN); return (Collection<BE>) criteria.list();
... order by analysis2_.start_ts, this_.STOP_TS asc