Hi

I have the following Scenario...

INVOICE
          |
          ---------->ITEMS (ISet<Iitem>)


mapping:
INVOICE

<set name="items" inverse="true" lazy="true" .../>
<key column=""/>
<one-to-many class="Item" />
</set>

Everything is fine and good but I'm having a problem with querying
some
specific scenario.

SCENARIO: Client wants INVOICE'S THAT HAVE A CERTAIN ITEM WITH A
CERTAIN DESCRIPTION

var description=...

ICriteria query = session.CreateCriteria<Invoice>();

if (!string.IsEmptyOrNull(description))
query.CreateCriteria<Item>()
    .Add(Restrictions.Eq("Description",description));

Now the query is doing his job very well but after adding the criteria
of description I
want to load the items eagerly...I do something like this

query.SetFetchMode("Items",FetchMode.Eager);

IList<Invoice> list=query.List<Invoice>();

and the query does not load the items eagerly, it does load proxy-s

I need the Items for some reason when I'm not in the session scope
otherwise
I run in a Select n+1 problem, I need somehow to load Items eagerly ..

Can you help..

I tried different options but they just don't load eagerly.

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

Reply via email to