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? 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 <[email protected]> wrote: [snip]
