ToOne Fault

From: Tore Halset (halse..vv.ntnu.no)
Date: Wed Sep 03 2008 - 07:58:56 EDT

  • Next message: Andrus Adamchik: "Re: ToOne Fault"

    Hello.

    I have a toOne relationship A->B. Both A and B use the same multi-
    column primary key. All Bs are already in the DataRowStore.
    DataObjectUtils.objectForPK() on any of the Bs work fine with no
    queries to the database.

    If I create a new DataContext and fetch in some As and issue a.getB(),
    then a query is run on the database. Why not look in the DataRowStore
    first?

    I have debugged this and found some interesting stuff in
    DataDomainQueryAction to handle RelationshipQuery around line 188.

                 // check if we can derive target PK from FK... this
    implies that the
                 // relationship is to-one
                 if (relationship.isSourceIndependentFromTargetChange()) {
                     return !DONE;
                 }

    The thing that makes this return is
    ObjRelationship.isToDependentEntity() that returnes true. Why does
    this have to force us to requery the toOne relationship? Any way
    around this?

    This is happening on trunk, M4 and M3

    Regards,
      - Tore.



    This archive was generated by hypermail 2.0.0 : Wed Sep 03 2008 - 07:59:49 EDT