[OS-JIRA] Created: (CAY-83) Please implement r/w prefetching in a one-to-many relationship

From: jir..bjectstyle.org
Date: Sat Jan 24 2004 - 03:50:48 EST

  • Next message: jir..bjectstyle.org: "[OS-JIRA] Created: (CAY-84) Please implement r/w prefetching in a one-to-many relationship"

    Message:

      A new issue has been created in JIRA.

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

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

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-83
        Summary: Please implement r/w prefetching in a one-to-many relationship
           Type: Improvement

         Status: Assigned
       Priority: Critical

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Versions:
                 1.0 [STABLE]

       Assignee: Andrus Adamchik
       Reporter: Scott Ellsworth

        Created: Sat, 24 Jan 2004 3:49 AM
        Updated: Sat, 24 Jan 2004 3:49 AM
    Environment: MacOS X 10.3.2/Java1.4.1/Cayenne 1.0.5/MySql 4.0.14

    Description:
    Given the following code:

            public static List getSummaries(Expression e) {
                    DataContext ctxt = createContext();
                    List results=new ArrayList();
                    SelectQuery = new SelectQuery(Game.class);
                    q.setPageSize(50);
                    q.addPrefetch(Game.PLAYERS_PROPERTY);
                    q.addPrefetch(Game.SYSTEMS_PROPERTY);
                    List l= ctxt.performQuery(q);
                    for (Iterator iterator = l.iterator(); iterator.hasNext();) {
                            Game game = (Game) iterator.next();
                            results.add(new GameSummary(game.getGameName(), game.getPlayers().size(), game.getSystems().size()));
                    }
                    return results;
            }

    where:
    Game toMany Players
    Game toMany Systems
    and
    Players toOne Game
    Systems toOne Game

    I get the error:

    Exception in thread "main" org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0.5 December 22 2003] Only to-one relationships are supported at the moment. Can't prefetch to-many: systems
            at org.objectstyle.cayenne.access.DataContext.prefetchRelationships(DataContext.java:923)
            at org.objectstyle.cayenne.access.IncrementalFaultList.fillIn(IncrementalFaultList.java:230)
            at org.objectstyle.cayenne.access.IncrementalFaultList.<init>(IncrementalFaultList.java:174)
            at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:807)
            at com.alodar.starmap.GameSummary.getSummaries(GameSummary.java:126)
            at com.alodar.starmap.GameSummary.getSummaries(GameSummary.java:112)
            at com.alodar.starmap.GameSummary.getGameCount(GameSummary.java:91)
            at com.alodar.starmap.GameSummary.main(GameSummary.java:67)
    Process terminated with exit code 1

    This, of course, is not a great surprise now that I read the docs - if I understand it right, only one-one and many-many relationships prefetch.

    I have filed this so that others searching like I did for "prefetch one-to-many" will find out when it is fixed.

    This will be an important feature for us, as we have quite a number of to-one, to-many, and many-to-many relationships in our schema. We are quite willing to move to 1.1 if that would help.

    Scott

    ---------------------------------------------------------------------
    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 : Sat Jan 24 2004 - 03:50:52 EST