Re: Prefetch in SelectQuery with a Qualifier

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Nov 13 2003 - 13:20:29 EST

  • Next message: wwlo..itao.com: "how to translate a sqlselectquery to correct object?"

    I'm reading my mail backwards and saw that Andrus already replied to this.
    Unfortunately I didn't pay a lot of attention to the response, but I think
    he didn't have an answer.

    I'm not sure exactly what line in
    org.objectstyle.cayenne.access.util.QueryUtils$ExpressionTranslator.reverseDbPath(QueryUtils.java:520)
    that you're hitting since I'm running an old cvs checkout from 9/28 myself
    and my line numbers don't match, but I had a similar error when I imported
    an EOModel and it didn't correctly create reverse DB-obj relationships. It
    seems likely that you're having the same problem.

    I think there's a bug report or RFE on this to generate a more meaningful
    error.

    -Mike

    Jorge Sopena <jsopen..idsa.es> wrote:
    > As in the examples of prefetching, I'm trying to prefetch some
    > relationships in my SelectQuery.
    > If I do a simple prefetch over a SelectQuery without any Qualifier, it
    > goes right.
    > SelectQuery query = new SelectQuery(Request.class);
    > query.addPrefetch("customer");
    > query.addPrefetch("customer.company");
    >
    > But if my SelectQuery has a Qualifier, an exception is thrown:
    > SelectQuery query = new SelectQuery(Request.class,where);
    > query.addPrefetch("customer");
    > query.addPrefetch("customer.company");
    >
    > This is the message error:
    > java.lang.NullPointerException
    > at
    >
    org.objectstyle.cayenne.access.util.QueryUtils$ExpressionTranslator.reverseDbPath(QueryUtils.java:520)
    > at
    > org.objectstyle.cayenne.access.util.QueryUtils$ExpressionTranslator.<init>
    (QueryUtils.java:430)
    > at
    >
    org.objectstyle.cayenne.access.util.QueryUtils.transformQualifier(QueryUtils.java:353)
    > at
    >
    org.objectstyle.cayenne.access.util.QueryUtils.selectPrefetchPath(QueryUtils.java:321)
    > at
    >
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:794)
    > at
    >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:866)
    > at
    >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:744)
    > at MapServer.Persistence.Request.search(Request.java:159)
    >
    > Am I doing sth wrong?
    > Is there any restriction I should know?
    >
    > Thanks,
    >
    > Jorge Sopena



    This archive was generated by hypermail 2.0.0 : Thu Nov 13 2003 - 13:20:23 EST