Re: missing reverse relationship causes NPE

From: Andrus (andru..bjectstyle.org)
Date: Tue Nov 12 2002 - 22:54:31 EST

  • Next message: Craig Miskell: "ObjectId and objEntityName"

    I just got a report from Eric Schneider about a similar problem. I am
    looking into it now. Bug that I filed can be found here:

    http://sourceforge.net/tracker/index.php?func=detail&aid=637545&group_id=48132&atid=452068

    Andrus

    At 03:52 PM 11/8/2002 +0000, Andrus Adamchik wrote:
    >Hmm, I need to look at that. I thought we'd fixed most of the problems in
    >this area. I agree with your ideas though. Will get back on this later.
    >Andrus
    >
    >Dirk Olmes writes:
    >>Hi,
    >>while playing around with reflexive relationships I encountered a strange
    >>NullPointerException:
    >>java.lang.NullPointerException
    >> at
    >>org.objectstyle.cayenne.QueryHelper.selectRelationshipObjects(QueryHelper.java:280)
    >> at
    >>org.objectstyle.cayenne.access.util.RelationshipDataSource.updateListData(RelationshipDataSource.java:86)
    >> at
    >>org.objectstyle.cayenne.access.ToManyList.getObjectList(ToManyList.java:113)
    >> at
    >> org.objectstyle.cayenne.access.ToManyList.iterator(ToManyList.java:187)
    >> at bm.MissingBackRelationship.main(MissingBackRelationship.java:33)
    >>The same bug shows up in normal relationships as well.
    >>A closer look into the source reveals that
    >>DBRelationship::getReverseRelationship() is indeed allowed to return
    >>null. The code in QueryHelper however does not check the
    >>return value but happily calls srcFkSnapshotWithTargetSnapshot().
    >>The workaround would be to model the reverse relationshpip in the
    >>DBEntity.... I wonder
    >>however if there is a reason for requiring both relationships to be present:
    >>in EOF
    >>this could cause the most infamous "add to to-many relationship" bug.
    >>Could this effect also show up in Cayenne?
    >>A possible better implementation could be to not rely on the reverse
    >>relationship to be present
    >>but simply create a temporary relationship and use that for resolving the
    >>to-many....
    >>-dirk
    >>--
    >>+++ GMX - Mail, Messaging & more http://www.gmx.net +++
    >>NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!



    This archive was generated by hypermail 2.0.0 : Tue Nov 12 2002 - 22:53:42 EST