1
votes
SELECT O.*, P.* FROM ORDERS O, PRODUCT P WHERE O.ORDER_ID=P.ORDER_ID;

What would be the Criteria representation of the above query?

1
orders and products are not related with a (.NET) reference? - Stefan Steinegger

1 Answers

4
votes

If you have something like this:

public class Order
{
   public virtual ISet<Product> Products {get;set}
}

You need to do

session.CreateCriteria(typeof(Order))    
    .SetFetchMode("Products", FetchMode.Eager)    
    .List();

That's it.