cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: ObjectContext.localObject refactoring
Date Mon, 05 Sep 2011 01:20:08 GMT
I also find localObject() a very confusing name. At the very least it should be a verb, which
is what Michael is getting at with his examples.


This would be accompanied by changes in the documentation terminology. You would "attach"
an object to a context, either automatically in the case of normal Cayenne object creation,
or by hand for POJOs (the Hibernate way), when copying from one context to another, etc. Ultimately
the same verb "attach" can be used to describe all those actions.


On 4/09/11 10:03 AM, Michael Gentry wrote:
> Just the other day I started to try to explain this to a co-worker and
> essentially told them "don't question it, just use it."  That's
> probably not the best answer.
> I'm still not sure I like the method name localObject().  I think it
> should be clear to the user that it takes an existing object (not a
> new one) in one context and makes a copy of it to be also managed by a
> different context.  We need to keep localObject() around for a bit,
> though, for backward compatibility.
> Throwing some naming ideas out:
> add(object)
> manage(object)
> register(object)
> registerExistingObject(object) -- would be similar to registerNewObject(object)
> In short, though, I agree this API should die.  :-)
> mrg
> On Sat, Sep 3, 2011 at 5:16 PM, Andrus Adamchik<>  wrote:
>> I've got tired of doing:
>> Artist localArtist = (Artist) context.localArtist(artist.getObjectId(), null);
>> Aside from causing confusion about the second argument (should it be 'artist'? no,
it should be null), it is still plain ugly. Anyone sees any flaws with the reasoning behind
this Jira?
>> Andrus

Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message