[OS-JIRA] Created: (CAY-218) Unneeded queries when prefetching on to-many with inheritance

From: jir..bjectstyle.org
Date: Thu Oct 21 2004 - 22:06:46 EDT

  • Next message: Mike Kienenberger: "calling resolveFault() on a transient DataObject"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-218

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-218
        Summary: Unneeded queries when prefetching on to-many with inheritance
           Type: Bug

         Status: Assigned
       Priority: Major

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Fix Fors:
                 1.1
       Versions:
                 1.1

       Assignee: Andrus Adamchik
       Reporter: Andrus Adamchik

        Created: Thu, 21 Oct 2004 10:05 PM
        Updated: Thu, 21 Oct 2004 10:05 PM

    Description:
    Originally reported here http://objectstyle.org/cayenne/lists/cayenne-user/2004/10/0132.html by Derek Rendall.

    Conditions:
     - A hierarchy of entities using single-table inheritance - these serve as a query root.
     - A to-many relationship defined in a non-leaf entity
     - A prefetch on to-many is specified in the query.

    Expected: Two queries - one for the root, one for prefetch

    Actual: in addition to the two expected queries, there is a number of queries executed in an attempt to resolve the inheritance hierarchy of the target of reverse to-one relationship (the reverse of the one being prefetched). E.g.:

    cayenne INFO [main 10-21 21:58:46] QueryLogger: SELECT t0.SALARY, t0.NAME, t0.PERSON_TYPE, t0.PERSON_ID, t0.DEPARTMENT_ID FROM PERSON t0 WHERE (t0.PERSON_TYPE = ?) OR (t0.PERSON_TYPE = ?) [bind: 'EE', 'EM'] - prepared in 13 ms.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: === returned 3 rows. - took 51 ms.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: SELECT t0.CITY, t0.PERSON_ID, t0.ADDRESS_ID FROM ADDRESS t0, PERSON t1 WHERE t0.PERSON_ID = t1.PERSON_ID AND ((t1.PERSON_TYPE = ?) OR (t1.PERSON_TYPE = ?)) [bind: 'EE', 'EM']
    cayenne INFO [main 10-21 21:58:46] QueryLogger: === returned 4 rows. - took 6 ms.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: +++ transaction committed.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: --- will run 1 query.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: --- transaction started.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: SELECT t0.SALARY, t0.NAME, t0.PERSON_TYPE, t0.PERSON_ID, t0.DEPARTMENT_ID FROM PERSON t0 WHERE (t0.PERSON_ID = ?) AND ((t0.PERSON_TYPE = ?) OR (t0.PERSON_TYPE = ?)) [bind: 3, 'EE', 'EM']
    cayenne INFO [main 10-21 21:58:46] QueryLogger: === returned 1 row. - took 7 ms.
    cayenne INFO [main 10-21 21:58:46] QueryLogger: +++ transaction committed.

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Thu Oct 21 2004 - 22:06:48 EDT