Hi All,
A few weeks ago, I posted a question about "batch fetching" support (
http://sourceforge.net/forum/message.php?msg_id=3110550).
The solution suggested to me was to use "from Parent p left join fetch p.Children" syntax in a query.
This pretty much achieves what I need in terms of reducing the SQL calls to one, however it introduces a new problem.
With regards to the following query,
Code:
IList orders = ses1.Find("from clsOrderHeader o left join fetch o.OrderDetails");
Lets say that there are 3 'header' rows, each one having say '5' children. The resulting orders IList will contain 15 clsOrderHeader objects. Basically, 5 instances of each one (ie one for each detail row).
Can someone please tell me if this is expected behaviour? Is there a way to reduce it to the correct amount? Should I be manually filtering it?
For brevity, I've not included my hbm.xml files but obviously am more than happy to if it will help. I don't think that this is the problem though because, when I use 'normal' CreateCriteria sytax, the code runs fine.
Thanks very much for your help.
Damien Sawyer