Re: Testing for Pagination

From: Gary Jarrel (garyjarre..mail.com)
Date: Wed Jun 30 2010 - 04:51:45 UTC

  • Next message: Andrey Razumovsky: "Re: Testing for Pagination"

    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



    This archive was generated by hypermail 2.0.0 : Wed Jun 30 2010 - 04:53:21 UTC