Hi all
I have a one-to-many relation between the entities (say, Order and OrderDetails) and there can be many (possibly hundred thousand) OrderDetails per Order. Therefore it is impossible to load the complete collection into memory, rather I have to load them via where clauses, to just load those portions of the OrderDetails table which I need.
Currently I am trying to implement it in this manner:
- lazy-loading = "true"
- cascade = "none"
- do not use the collection property on the Order class (this would trigger a lazy load)
- instead, load the collection partially with session.CreateCriterion
Am I missing a better approach for this scenario? Is there something like a recommended pattern?
Perhaps a better approach would be something like
Code:
<class name="Order">
<set name="OrderDetails" where="MY_WHERE_CLAUSE">
...
</set>
</class>
and then adapt MY_WHERE_CLAUSE dynamically, but I don't think this is possible.
Thank you for any hints!
Jonas