makePersistent(pc) - JDO PersistenceManager's method
PersistenceManager. This method makes transient instances persistent and applies detached instance changes to the cache. It must be called in the context of an active transaction, or a JDOUserException is thrown. For a transient instance, it assigns an object identity to the instance and transitions it to persistent-new. Any transient instances reachable from this instance via persistent fields of this instance become provisionally persistent, transitively. That is, they behave as persistent-new instances (return true to isPersistent, isNew, and isDirty). But at commit time, the reachability algorithm is run again, and instances made provisionally persistent that are not then reachable from persistent instances will revert to transient.
During makePersistent of transient instances, the create life cycle listener is called.
For detached instances, it locates or instantiates a persistent instance with the same JDO identity as the detached instance, and merges the persistent state of the detached instance into the persistent instance. Only the state of persistent fields is merged. If non-persistent state needs to be copied, the application should use the jdoPostAttach callback or the postAttach lifecycle event listener. Any references to the detached instances from instances in the closure of the parameter instances are modified to refer to the corresponding persistent instance instead of to the detached instance.
During attachment of detached instances, the attach callbacks and attach life cycle listeners are called.
During application of changes of the detached state, if the JDO implementation can determine that there were no changes made during detachment, then the implementation is not required to mark the corresponding instance dirty. If it cannot determine if changes were made, then it must mark the instance dirty. No consistency checking is done during makePersistent of detached instances. If consistency checking is required by the application, then flush or checkConsistency should be called after attaching the instances.
These methods have no effect on parameter persistent instances already managed by this PersistenceManager. They will throw a JDOUserException if the parameter instance is managed by a different PersistenceManager. If an instance is of a class whose identity type (application, datastore, or none) is not supported by the JDO implementation, then a JDOUserException will be thrown for that instance. The return value for parameter instances in the transient or persistent states is the same as the parameter value. The return value for parameter instances in the detached state is the persistent instance corresponding to the detached instance. The return values for makePersistentAll methods correspond by position to the parameter instances.
pc- an instance of a
Classthat is persistent capable.
- the parameter instance for parameters in the transient or persistent state, or the corresponding persistent instance for detached parameter instances
- JDO 1.0