CopyDetachedOnMakePersistent?

Craig

On Aug 8, 2007, at 11:31 PM, Andy Jefferson wrote:

Hi,

So if we introduce a flag that uses the same instance on attach, we
might want to have the flag called CopyOnMakePersistent and have
true be the current specified behavior and false be the new
behavior we've been discussing.

Sounds great to me.  There's some fine print here, though:  Just
because CopyOnMakePersistent is set to true, that doesn't mean that
makePersistent() will *always* return copies.  For example, current
specified behavior says that when DetachAllOnCommit=false and calling
makePersistent() with a transient parameter, the returned object will
be the same instance, now transitioned to persistent-clean.  This
behavior won't change because of our new option (regardless of
whether it is set to true or false), and we don't want folks to be
confused about that...

I prefer the name you suggested to the one I originally wrote. Comments :-

1. "DetachAllOnCommit" has no bearing on what makePersistent() does - it defines what happens on tx.commit() only. makePersistent will (currently) return the original object if persisting a transient and return a copy if
attaching.

2. How about calling it CopyOnAttach ? makePersistent has two roles ...
persisting new, and attaching detached. I don't ever see a need to add
control to the operation of persisting a new object, so the
name "CopyOnAttach" distinguishes to just the attach process.




--
Andy  (Java Persistent Objects - http://www.jpox.org)

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to