Hollow vs committed object conflict

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Thu Oct 07 2004 - 16:19:39 EDT

  • Next message: Mike Kienenberger: "Bug: Committed object considered transient by validation -- how could it happen?"

    I am trying to use a named query with an in-memory expression as follows:

    DataContext context = DataContext.createDataContext();
    SelectQuery q = (SelectQuery)
    context.getEntityResolver().getQuery("NamedQuery");
            
    Map params = new HashMap();
    params.put("obj", filterObj);

    Expression qual = Expression.fromString("toDomainObject=$obj");
    return (RefJurisdictionInLang) qual.expWithParameters(params).
            filterObjects(context.performQuery(q)).get(0);

    Before someone asks why I'm not just using getToDomainObject(), I've
    simplified the expression for testing and to make the post more clear :)

    The problem is the expression is returning an empty list every time, despite
    there being a match. After going through the debugger, I've found that its
    "finding a match".. For some reason, Cayenne has made two different objects,
    one hollow and one committed. The object I'm using in my map is committed,
    but the objects the expression is comparing against are all hollow. This
    does not make sense as the query is set to prefetch the toDomainObject
    relationship.

    Is there a reason why Cayenne is comparing against hollow objects when doing
    the in-memory evaluation?

    Thanks,

    Cris



    This archive was generated by hypermail 2.0.0 : Thu Oct 07 2004 - 16:17:36 EDT