An instance of a persistent class has a lifecycle state that the JDO implementation manages. This lifecycle state is used to determine whether the instance is persistent, loaded, modified, or deleted. During a persistent instance's lifetime in memory, as operations are performed on it, it transitions among various lifecycle states, until it is finally garbage-collected by the JVM.
This chapter describes the lifecycle states required in all JDO implementations. We assume that the RetainValues flag is set to false. Chapter 14 covers the effect of having RetainValues set to true. We discuss the methods available to determine the lifecycle state of an instance. We conclude by discussing the various state transitions that occur to instances during a transaction, when a transaction completes, and between transactions.
As a developer using JDO, you do not really need to understand these lifecycle states and transitions or directly use their related APIs to write your application. These lifecycle states primarily concern JDO implementations, to ensure they correctly implement the JDO APIs. You may occasionally want to determine the state of an instance in more complex usage scenarios; knowing the state of an instance may be useful during debugging. Being aware of these states will give you a better understanding of how an implementation manages instances and the in-memory cache. Some of the early JDO adopters focused considerable attention on these states, giving many the impression that they were a fundamental aspect of using JDO. In reality, most applications never need to deal with these states directly.