|
During the persistence process, whether using JDO or JPA APIs, an object goes through
lifecycle changes. The following diagram highlights the crucial points in the
objects lifecycle.
So a newly created object is
transient
. You then persist it (via either
JDO
makePersistent
or JPA
persist
) and it becomes
persistent
.
You can then detach it for use elsewhere in the application, so it is
detached
.
When attaching any changes back to persistence (via JDO
makePersistent
or
JPA
merge
) it becomes
persistent
again.
Finally when you delete the object from persistence it is in
transient
state.
With JDO there are actually some additional lifecycle states, notably when an
object has a field changed, becoming
dirty
, so you get an object in
"persistent-dirty", "detached-dirty" states for example.
|
|