On Mon, Sep 5, 2011 at 2:33 AM, Aristedes Maniatis <[email protected]> wrote: > I don't > know that I've tried it: what does localObject() do if the object already > exists in the target context? Will it overwrite any modified attributes?
Unless something has changed, localObject(obj) returns the original object obj if it is already in the context. I don't find localCopy() that confusing. But perhaps attachLocalCopy() would be better. attachCopy() makes it sound like a copy is always created. However, the only piece of information not conveyed in the current (or proposed) naming schemes that I wish was conveyed is that modified changes in the original object will not be copied into the new object. That isn't obvious or intuitive. By the way, JPA.merge() is not close enough to localCopy() to use. Merge is more of a "update the object if it already exists rather than inserting a new one at commit". I think merge() would be a bad choice.
