Not sure if I should open a new issue or wait for someone to reopen
this one...

The problem still exists in 3.0.0_Beta2.

I've created a test case to demonstrate the issue:

[Test]
public void SubselectFetchPaging()
{
    ISession s = OpenSession();
    ITransaction t = s.BeginTransaction();

    for (int i = 0; i < 10; i++)
    {
        string pName = "p" + i.ToString().PadLeft(2, '0');
        Parent p = new Parent(pName);
        for (int j = 0; j < 10; j++)
        {
            string cName = pName + '_' + j.ToString().PadLeft(2,
'0');
            p.Children.Add(new Child(cName));
        }
        s.Save(p);
    }

    t.Commit();
    s.Close();

    s = OpenSession();
    t = s.BeginTransaction();

    sessions.Statistics.Clear();

    IList parents = s.CreateCriteria(typeof(Parent))
                                    .SetFirstResult(3)
                                    .SetMaxResults(4)
                                    .List();

    Parent px = (Parent)parents[0];
    int childCount = px.Children.Count;

    Assert.AreEqual(10, childCount);

    // We should have 44 entities loaded ( 4 parents + 40 children )
but
    // currently it loads 104 entities ( 4 parents and 100 (ALL)
children )
    Assert.AreEqual(44, sessions.Statistics.EntityLoadCount);

    parents = s.CreateCriteria(typeof(Parent)).List();

    foreach (Parent pToDelete in parents)
    {
        s.Delete(pToDelete);
    }

    t.Commit();
    s.Close();
}

-- 
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