views:

15

answers:

0

Hi. I have a class called Order that contains a property called TotalAmount and a list called OrderItems. Each order item is like a product and contains a property called Amount (which is like the price).

I would like to have TotalAmount return the sum of amounts of those OrderItems that belong to that property.

I know two ways of doing this: a) have OrderItems be loaded either eagerly or lazily and have TotalAmount property contain a for loop to sum up the amounts b) use a property formula in the mapping (but this creates a subquery)

Is there any way to do this in a join manner? I believe a join would be faster than a sub-query - especially for such a table that can contain millions of records.

thx