Re: CayenneDataObjects across RMI

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Sep 14 2005 - 19:36:13 EDT

  • Next message: Gili: "ObjectStoreValidationTst"

    Joshua is entirely correct. Let me fill in some details. Essentially
    there are three cases:

    1. Your RMI client needs persistence features and is allowed to
    access database directly. In this case Cayenne serialization
    mechanism (deserializing HOLLOW objects) should work fine. Just
    serialize the whole DataContext instead of individual objects.

    2. Your RMI client needs persistence features, but can't access
    database directly. In this case you are better off using new multi
    tier stuff. I recommend latest nightly builds - they are quite capable.

    http://objectstyle.org/confluence/display/CAY/Multi+Tier

    3. (I suspect this is what you need) Your RMI client just needs a
    fully inflated object graph with no ability to fault or change it. In
    this case you either follow Joshua's advice and create value objects,
    or again - serialize the whole DataContext if you can... Value
    objects is more work, but is a cleaner solution as with a DataContext
    you could easily trip over an unresolved fault that would result in
    exception. Besides, depending on your server app use pattern, you may
    have more stuff in the DataContext than you want... But this is a
    quick and easy solution (at least I think so - I haven't used RMI for
    years).

    Andrus

    On Sep 14, 2005, at 7:12 PM, Joshua Pyle wrote:

    > Do not pass Cayenne data objects though RMI.
    >
    > I hear though that there is a multi-tier implementation of cayenne
    > in the works.
    >
    > In the mean time, on the client you should recieve value objects
    > instead of cayenne data objects. You might consider leaving the
    > server side cayenne alone and adding a method to each Cayenne Data
    > Object that returns a "value object"(bean) with the copied values.
    >
    > One issue you will have is getting related objects throught the "value
    > object". You would need to implement code in the value object that
    > was capable of connecting to your server side RMI and getting value
    > objects related to the original "value object" in question.
    >
    > Hope this helps a bit. There is no easy way to pass Cayenne objects
    > via RMI that I know of :-(
    >
    >
    > --
    > Joshua T. Pyle
    > Go has always existed.
    >
    >
    > On 9/14/05, Todd O'Bryan <toddobrya..ac.com> wrote:
    >
    >> I've run into a small problem and I'm hoping there's an easy fix. I'm
    >> writing an application that uses RMI to fetch objects from a server.
    >> The problem, of course, is that the objects are hollow when they get
    >> grabbed, and then when I want to to do something with them, they're
    >> in the JVM on the client machine and don't know how to fill in their
    >> missing info.
    >>
    >> Is there a (mostly) standard way to handle this kind of thing?
    >>
    >> Thanks,
    >> Todd



    This archive was generated by hypermail 2.0.0 : Wed Sep 14 2005 - 19:36:15 EDT