db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@jpox.org>
Subject Re: 2.1 Spec: detached-dirty parameters to makePersistent() when DetachAllOnCommit=true
Date Thu, 09 Aug 2007 06:31:31 GMT

> > 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 

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)

View raw message