Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] How does EclipseLink clone objects?


thank you very much.


Date: Fri, 15 Apr 2011 07:40:42 -0700
From: PETER.KROGH@xxxxxxxxxx
To: eclipselink-dev@xxxxxxxxxxx
Subject: Re: [eclipselink-dev] How does EclipseLink clone objects?

Also, one more thing...
One of the other committers reminded me, that one of the other difficult parts is maintaining referentional integrity.
That is what the Identity Map is for.
-----Original Message-----
From: Peter Krogh
Sent: Friday, April 15, 2011 9:16 AM
To: Dev mailing list for Eclipse Persistence Services
Subject: Re: [eclipselink-dev] How does EclipseLink clone objects?

To do a proper clone, you need to deep copy, that means walking the relationships and cloning each of them. 
EclipseLink's cloning does backup clone and working copy cloning, and also is optimized to stop at untriggered relationships.  That is likely the complexity that you are referring to.
Note: that with weaving change tracking enabled, clones are not usually required, as we track the changes in place.
I hope that this answer is helpful.
Good luck.
-----Original Message-----
From: Martin Ledvinka [mailto:martin.ledvinka@xxxxxxxxxxx]
Sent: Friday, April 15, 2011 5:12 AM
To: eclipselink-dev@xxxxxxxxxxx
Subject: [eclipselink-dev] How does EclipseLink clone objects?

Hi all,

this may be a little strange question, but still. I study at the Czech Technical University and my bachelor's project is transactional processing for a persistence layer developed at the university. This layer control access to ontologies, not relational databases. I got inspired by the EclipseLink and here's my question:

Can you, please, give me a little advice about cloning objects? I've developed the Unit of Work system, quite similar to the one in EclipseLink (but much simpler), but the way EclipseLink creates clones is quite complex. Is there an easier way to clone objects? I understand that making shallow copies won't work, but I don't know how to solve relationships when cloning. Should I clone all the objects the given one is in relationship with? Or is there another solution?

Thanks very much

Martin Ledvinka

_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx

Back to the top