Hi,

I have this structure of entities:

CustomerOrderSet

        -> contains CustomerOrders (a Set can contain more than one Order)
                this is the entity property:
                        public virtual IList<CustomerOrder> CustomerOrders
                this is the mapping:
                        <bag name="CustomerOrders" inverse="true" 
cascade="save-update" >
                                <key column="CustomerOrderSetId" />
                                <one-to-many class="CustomerOrder" />
                        </bag>

                -> contains OrderDetails  (an Order can contain more than one
Detail)
                        this is the entity property:
                                public virtual IEnumerable<OrderDetail> 
OrderDetails
                        this is the mapping:
                                <bag name="OrderDetails" 
cascade="all-delete-orphan"
inverse="true" access="field.camelcase-underscore">
                                        <key column="CustomerOrderId" />
                                        <one-to-many class="OrderDetail" />
                                </bag>

                        -> contains CellUnits (many-to-many relation: an 
OrderDetail can
contain more than one CellUnit, a CellUnit can be contained by more
than one OrderDetail)
                                this is the entity property:
                                        public virtual 
IEnumerable<ProductDetailCellUnit>
ProductDetailCellUnits
                                this is the mapping:
                                        <bag name="ProductDetailCellUnits"
table="OrderDetailXProductDetailCellUnit" access="field.camelcase-
underscore">
                                                <key column="OrderDetailId" />
                                                <many-to-many 
column="ProductDetailCellUnitId"
class="ProductDetailCellUnit" />
                                        </bag>

                                -> contains a Product (a CellUnit has a 
corresponding Product)
                                        this is the entity property:
                                                public virtual Product 
ProductCorrespondent { get; set; }
                                        this is the mapping:
                                                <many-to-one name="Product" 
column="ProductId" class="Product"></
many-to-one>

Considering a CustomerOrderSet which has 4 CustomerOrders, each
CustomerOrder has 3 or 4 OrderDetails, each OrderDetail has 5 or 6
CellUnits, and each CellUnit has its corresponding Product, what is
the best way to load the CustomerOrderSet with all this information in
it?

Ideally, the solution:
- uses as few select statements as possible
- creates no duplicated data in the hierarchy
- avoids select n+1

I already saw this thread:
http://groups.google.com/group/nhusers/browse_thread/thread/b38ab29ae650c091/f9d84f58efc5a53f,
but since then new features have been added to NHibernate (like
Futures), so I am not sure which option is the right one.
Some code examples would be great.
Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to