NullPointerException in QueryUtils$ExpressionTranslator.reverseDbPath(ObjEntity, String)

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Oct 02 2003 - 13:12:32 EDT

  • Next message: Mike Kienenberger: "Re: NullPointerException in QueryUtils$ExpressionTranslator.reverseDbPath(ObjEntity, String)"

    I tried to add some prefetching to my code today in order to speed some
    things up.

    Here's a simplified recreation of the code that caused the error.

            Collection prefetchList = new ArrayList();
            prefetchList.add("paymentHistory");
            Expression qualifier =
    ExpressionFactory.matchExp("paymentHistory.account.accountNumber",
    anAccountNumber);
            SelectQuery query = new SelectQuery(PendingPayment.class, qualifier);
            query.addPrefetches(prefetchList );
            return aDataContext.performQuery(query);

    Here's the stack trace. Note that this is using the modified DataContext
    with DataContextDelegate, so the DataContext line numbers will be off.


    Thread [Thread-4] (Suspended (exception NullPointerException))
            QueryUtils$ExpressionTranslator.reverseDbPath(ObjEntity, String) line: 523
            QueryUtils$ExpressionTranslator.<init>(ObjEntity, String) line: 433
            QueryUtils.transformQualifier(ObjEntity, Expression, String) line: 356
            QueryUtils.selectPrefetchPath(QueryEngine, SelectQuery, String) line: 324
            DataContext.performQueries(List, OperationObserver) line: 873
            DataContext.performQuery(GenericSelectQuery) line: 793

    in QueryUtils$ExpressionTranslator.reverseDbPath(ObjEntity, String), reverse
    is null for

            DbRelationship reverse = dbRel.getReverseRelationship();
            buf.insert(0, reverse.getName());

    I'm not sure if this is some condition that Cayenne should handle better, so
    I figured I better report it.

    My problem, maybe irrelevent, is probably that PendingPayment should be set
    toDependentPK=true since PendingPayment has the same primary key as
    PaymentHistory and is really nothing more than a database pointer into the
    PaymentHistory table, but currently is set to toDependentPK=false.



    This archive was generated by hypermail 2.0.0 : Thu Oct 02 2003 - 13:12:20 EDT