Hi Matthew,

On Mar 12, 2010, at 8:43 AM, Matthew Adams wrote:

Hi all,

I have a question about the following assertion regarding getting an
object by exact class with no validation.

<craig>
12.6.5:
If the validate flag is false, the user asserts that the instance
exists and the object id represents the exact class of the persistent
instance (specifically not a subclass or an interface):
A12.6.5-2 [If the object id represents an interface or abstract class,
JDOUserException is thrown.]
A12.5.6-2 [If there is already an instance in the cache with the same
JDO identity as the oid parameter, then this method returns it.]
A12.5.6-3 [There is no change made to the state of the returned
instance.]
A12.5.6-4 [If there is not an instance already in the cache with the
same JDO identity as the oid parameter, then this method creates an
instance with the specified JDO identity and returns it. If there is
no transaction in progress, the returned instance will be hollow or
persistent-nontransactional, at the choice of the implementation.]
A12.5.6-5 [If there is a transaction in progress, the returned
instance will be hollow, persistent-nontransactional, or
persistent-clean, at the choice of the implementation.]
</craig>

Can you please tell me the state of the returned instance if there is
already an instance in the cache with the same JDO identity as the oid
parameter and the existing instance is not in any of the states
hollow, persistent-nontransactional, or persistent-clean?

Whatever it is currently. The relevant bit is right at the top.

A12.5.6-2 [If there is already an instance in the cache with the same
JDO identity as the oid parameter, then this method returns it.]
A12.5.6-3 [There is no change made to the state of the returned
instance.]

Stop reading here. Because the next sentence begins:
A12.5.6-4 [If there is not an instance already in the cache with the same JDO identity as the oid parameter, ...

So that's the delimiter between "already in the cache" and "not already in the cache".

Anyway, I've changed the indentation of the text to make it a bit more obvious that the bullets "If there is [not] a transaction in progress" belong to "If there is not an instance already in the cache".

WDYT?

Craig

A12.5.6-5
appears to me to state that the instance must be in one of these three
states.  It's not clear to me that A12.5.6-2 necessarily takes
precedence over A12.5.6-5.  The way it reads to me, it's almost as
though the presence of a transaction or not would cause the loss of
changes in the existing instance.  Maybe I'm off base, but I'd
recommend the following.

<matthew>
A12.5.6-5 [If there is a transaction in progress, the returned
instance will be hollow, persistent-nontransactional, or
persistent-clean, at the choice of the implementation, unless there
was a transactional instance in the cache with the same JDO identity
as the oid parameter, in which case the there is no change made to the
state of the returned instance.]
</matthew>

WDYT?

-matthew

On Thu, Mar 11, 2010 at 5:46 PM, Craig L Russell <craig.russ...@sun.com > wrote:
[snip]

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:craig.russ...@oracle.com
P.S. A good JDO? O, Gasp!

Reply via email to