exception in 1.2B1

From: Bryan Lewis (brya..aine.rr.com)
Date: Mon Apr 10 2006 - 20:07:58 EDT

  • Next message: Marcin Skladaniec: "Re: toMany relationship not fetched"

    I put the 1.2B1 jar on our servers over the weekend and got one little
    surprise today... an exception when a prefetch is specified on a caching
    query. Here's some code that reproduces it, then the stack trace.

        public static List fetchBankruptciesForPastYear(DataContext dc)
        {
            // Omitting the expression details...
            SelectQuery query = new SelectQuery("BKFiler", exp);

            query.setCachePolicy(QueryMetadata.SHARED_CACHE);
            String queryName = "BCI";
            query.setName(queryName);
            query.setRefreshingObjects(false);

            // Omitting the orderings details...
            query.addOrderings(orderings);

            // This line works okay for the first fetch, but causes an exception
            // on subsequent (non-refreshing) fetches. Removing this line
    avoids
            // the exception.
            query.addPrefetch("company");

            return dc.performQuery(query);
        }

    java.lang.NullPointerException
    org.objectstyle.cayenne.access.ObjectTreeResolver$TreeBuilder.addNode(ObjectTreeResolver.java:218)
    org.objectstyle.cayenne.access.ObjectTreeResolver$TreeBuilder.startDisjointPrefetch(ObjectTreeResolver.java:178)
    org.objectstyle.cayenne.access.ObjectTreeResolver$TreeBuilder.startUnknownPrefetch(ObjectTreeResolver.java:201)
    org.objectstyle.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:209)
    org.objectstyle.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:216)
    org.objectstyle.cayenne.access.ObjectTreeResolver$TreeBuilder.buildTree(ObjectTreeResolver.java:136)
    org.objectstyle.cayenne.access.ObjectTreeResolver.resolveObjectTree(ObjectTreeResolver.java:100)
    org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:372)
    org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
    org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:715)
    org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:249)
    org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
    org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1320)
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1309)
    model.BKFiler.fetchBankruptciesForPastYear(BKFiler.java:68)
    model.Model.fetchBankruptciesForPastYear(Model.java:511)



    This archive was generated by hypermail 2.0.0 : Mon Apr 10 2006 - 20:08:25 EDT