fun with graphs

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Feb 09 2006 - 18:48:04 EST

  • Next message: Marcin Skladaniec: "Re: Problems with caching"

    I think I finally nailed down the select part of the nested contexts.
    I am planning to make an M11 release sometime this weekend.

    I spent an enormous amount of time on the algorithm to merge object
    graphs between the contexts. As usual the solution was on the surface
    - our new ClassDescriptors should closely mimic DataObject read/write
    property API, no matter how the underlying object is implemented. So
    much for reinventing the wheel.

    On the positive side, I think the new algorithms can be used in many
    situations. One important case is generating a subgraph of "detached"
    objects that can be serialized and served via a web service. A number
    of people requested that before (not to mention that Cayenne remote
    stack needs that).

    Take a look at org.objectstyle.cayenne.util.ObjectDetachOperation. It
    uses a prefetch tree (same as the one used in SelectQuery) as a guide
    on what parts of subgraph need to be traversed, and starting at a
    given DataObject (or a list of DO's) it builds a subgraph of detached
    client objects in a controlled fashion.

    I think it may serve as a template for other similar uses (streaming
    XML serialization??).

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Feb 09 2006 - 18:48:03 EST