I have a series of classes that are mapped to their respective database 
objects.

In the mapping, the fetch mode is set so that associated lookups are loaded 
with the parent record.

I'm now referencing some of these objects, and as such I'm obviously 
getting the affiliated records eagerly loaded.

If possible I don't want to use lazy loading, as I'm passing these objects 
from a service layer - not ideal, but I'm hoping I can deal with this at a 
query level.

Take this example:

var c = s.CreateCriteria(typeof(Transaction))
                        .Add(Restrictions.Eq("Id", myId))
                        .SetFetchMode("Remark", FetchMode.Join)
                        .SetFetchMode("Category", FetchMode.Join)
                        .SetFetchMode("Reason", FetchMode.Join);

var t = c.List<Transaction>().FirstOrDefault();

Remark has many records associated with it, these are currently being 
loaded when I run this query.

Can you modify the ICriteria to prevent the reference entities loading 
their associations?

In this example, I only want Transction and its directly associated Remark, 
Category and Reason

Thanks

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to