I’m trying to only match a set partially, I mean for example
in my Product.hbm.xml, I have a of “recentOrders” which means I only want the very latest orders (order by timestamp of “Order”)
<set cascade="all-delete-orphan" inverse="true" name="recentOrders" lazy="true" >
<key on-delete="cascade">
<column name="product_id" not-null="true"/>
</key>
<one-to-many class="com.xx.Order"/>
</set>
should I use attribute of ”subselect” or “where” ? if yes, how ?
btw,I’m using hibernate 3.x, hibernate will not add any sql clause which is specified by attribute of “subselect” or “where”
Here is a good explanation. You can do it inside HQL query itself if it’s just a single time need. There is another option – using filters, note though that they are set for the session, not for a particular query.