cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <>
Subject Re: Easy way to update objects
Date Wed, 27 Apr 2011 12:49:19 GMT
If what you want to do is copy your detached objects values into a
non-detached object in the database....

You could use the metadata in the Cayenne model to iterate over the
attributes and relationships of the detached object and set them on
the matching object from the database.    I have done this in years
past to clone complex object graphs in WebObjects, and Cayenne has the
same API available.   A single method would work for any kind of
object -- you would not have to write a specific method for each

You might also be able to do this by serializing your object, then
unserializing it to a new data context -- I think I did this in a
Cayenne 2 project a few years back.

On Thu, Apr 21, 2011 at 10:15 AM, Christian Grobmeier
<> wrote:
> Hi,
> I have a detached object with a PK. I would like to update a matching
> object in the database with the values of the detached object.
> Can this easily done?
> At the moment i see only the chance to select an object from the
> database and manually copy over all the new values to the attached
> object. I can imagine you have some cool feature I couldn't find.
> Cheers
> Christian

View raw message