Value Object, serialization, state: hollow

From: Andrew Reed (andrew.ree..ut.ac.nz)
Date: Wed Feb 23 2005 - 19:36:12 EST

  • Next message: Andrus Adamchik: "Re: question about key generation"

    Hi, and apologies to everyone if this question has been asked before
    (I have searched and searched and cannot find a definite answer for my
    problem).

    I would like to know if there is a way of taking a CayenneDataObject
    and transforming it into a "Value Object". Let me explain why:

    I am trying to use cayenne on the server side of an application.
    Communication with the server is primarily through a Bus (SonicMQ)
    using JMS ObjectMessages. The clients of the bus are going to be a mix
    of Java and .Net (using SOAP probably). What I would like though is
    for the clients to receive an object representing the data they
    required, but not giving them access to the DataContext - forcing them
    to send a message back through the bus which would transform the value
    object back to a DataObject and save it as appropriate - thereby
    controlling the validation and whatever else of the data.

    What I have got so far is returning the CayenneDataObject to the
    client, but when I do a .toString() on it (client side), it gives me
    the primary key, and tells me "state: hollow". Ok, fair enough, at
    least it has serialized the primary key so I am confident I am getting
    something back. I have seen a few posts about serializing the
    DataContext and by using that dataxcontext I can the refresh my object
    - but I don't think that is what I want to do as I want to be quite
    restrictive of what the clients can do - prefering them not to care
    about what is running on the server side.

    Has anyone else solved a problem similar to this who would mind
    sharing with me what they have done? Is this something Cayenne
    supports already but I just haven't looked in the right place?

    Thanks for any help

    Andrew Reed

    Auckland University of Technology
    Auckland
    New Zealand



    This archive was generated by hypermail 2.0.0 : Wed Feb 23 2005 - 19:36:44 EST