Re: Cayenne in a framework -> Value Objects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jul 09 2004 - 18:03:33 EDT

  • Next message: Newton, Greg P.: "RE: transaction ordering"

    Ok, since this is a generic question, rather than an attempt to
    integrate Cayenne in a specific scenario, the answer is also vague ;-)

    DataContext can be viewed as a "session container" for DataObjects
    (http://objectstyle.org/cayenne/userguide/design/dataobj.html), so
    DataObjects have to be registered with some DataContext to be fully
    functional from persistence standpoint. Individual DataObjects can be
    transferred from one DataContext to another, so that each "session"
    maintains its own copy of objects.

    DataContext itself is "disconnected", so on deserialization it can be
    attached to any Cayenne stack. You can potentially have one on the
    client and one on the server. So for instance you can pull a context
    (or just a bunch of DataObjects - this seems cleaner as it involves
    less overhead) from the server, and register all involved deserialized
    objects with client DataContext bound to an HttpSession. This way no
    conflicts will occur. I guess this strategy will have to be tweaked
    further for various types of EJB's (though I assume you are mostly
    interested in stateless session beans).

    Andrus

    On Jul 9, 2004, at 12:58 PM, Fredrik Liden wrote:
    > Hi,
    >
    > A more general question. If two clients obtained the same DataObject
    > wouldn't there be some kind of conflict? How does the DataContext
    > handle
    > these kinds of transaction issues? Or once the DataObject is generated
    > is it completely independent of the DataContext?
    > And what kind of work on the deserialization do I need to do on the
    > DataObjects? And do I need to do that work even if the all the layers
    > are executing on the same machine? Pardon my rookie questions.
    >
    > You guys rock!
    >
    > /Fredrik



    This archive was generated by hypermail 2.0.0 : Fri Jul 09 2004 - 18:03:37 EDT