I am creating a winform application where I use Nhibernate. In my app I need to select all products in my database (74000 rows).
On my product object I have a list of objects, called barcodes.
I want to select all my products but the list of barcodes on earch product should only be filled with objects if the barcodetype = 20 and groupid = 4
I don’t know how to write this query, I have been trying with detached criteria, but I can’t get it to work. Can anybody help me writing the query, or with a link to a page where I can see how its done?
Since a collection can’t be “half-loaded”, you need a projection.
This is how I usually do it:
(I have assumed you have scalar properties called Barcodetype and Groupid, since you didn’t specify any relationships, and that all products have at least one barcode of that type)