Re: Testing for Pagination

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 30 2010 - 06:24:45 UTC

  • Next message: Gary Jarrel: "Re: Testing for Pagination"

    Exactly. Essentially it is "List.get(int)" method that loads the page,
    so once you get an object via this method it is already inflated.

    Andrus

    On Jun 30, 2010, at 8:40 AM, Andrey Razumovsky wrote:

    > For getting unresolved list, you can use
    > PersistentObjectList.getValueDirectly(), if that helps
    >
    > 2010/6/30 Gary Jarrel <garyjarre..mail.com>
    >
    >> On Wed, Jun 30, 2010 at 1:44 PM, Aristedes Maniatis
    >> <ar..aniatis.org>
    >> wrote:
    >>>
    >>> If that is happening, then that might be a bug. Could you put
    >>> logging in
    >>> there to identify exactly when you see the SQL query inflating the
    >> record?
    >>> Does it happen right after getPersistenceState()?
    >>>
    >>
    >> I've changed the test case to:
    >>
    >> List<Role> results = getDataContext().performQuery(s);
    >>
    >> assertEquals(5, results.size());
    >>
    >> Role r0 = results.get(0);
    >> Role r1 = results.get(1);
    >> assertEquals(PersistenceState.COMMITTED, r0.getPersistenceState());
    >> assertEquals(PersistenceState.COMMITTED, r1.getPersistenceState());
    >>
    >> Role r4 = results.get(4);
    >> assertEquals(PersistenceState.HOLLOW, r4.getPersistenceState());
    >>
    >> Stepping though the code with a debugger the following happens:
    >>
    >> List<Role> results = getDataContext().performQuery(s);
    >>
    >> Causes:
    >>
    >> SELECT t0.role_id FROM role t0
    >>
    >> Role r0 = results.get(0);
    >>
    >> Causes
    >>
    >> SELECT t0.name, t0.active, t0.role_id FROM role t0 WHERE
    >> (t0.role_id =
    >> ?) OR (t0.role_id = ?) [bind: 1->role_id:1, 2->role_id:2]
    >>
    >> As you said the whole page is inflated rather than a single object
    >>
    >> Nothing in the log until:
    >>
    >> Role r4 = results.get(4);
    >>
    >> Which causes:
    >>
    >> SELECT t0.name, t0.active, t0.role_id FROM role t0 WHERE t0.role_id =
    >> ? [bind: 1->role_id:5]
    >>
    >> Hence once this executes the test fails as r4 is not hollow!
    >>
    >> Gary
    >>
    >
    >
    >
    > --
    > Andrey



    This archive was generated by hypermail 2.0.0 : Wed Jun 30 2010 - 06:26:19 UTC