Implementation of the OpenJPAStateManager interface for use
with this runtime. Each state manager manages the state of a single
persistence capable instance. The state manager is also responsible for
all communications about the instance to the StoreManager.
The state manager uses the State pattern in both its interaction with
the governed instance and its interaction with the broker.
In its interactions with the persistence capable instance, it uses the
FieldManager interface. Similarly, when interacting with the
broker, it uses the PCState singleton that represents
the current lifecycle state of the instance.

StateManagerImpl

Create a new StateManager instance based on the StateManager provided. A
new PersistenceCapable instance will be created and associated with the
new StateManager. All fields will be copied into the ne PC instance as
well as the dirty, loaded, and flushed bitsets.

initialize

Initialize the state manager with a new instance of the given
persistence capable type and the proper lifecycle state.
Invoking this method may change the object id and metadata for the
state manager, as the concrete type specified in the parameter may be
a subclass of the expected type.

initialize

isIntercepting

public boolean isIntercepting()

Whether or not data access in this instance is intercepted. This differs
from ClassMetaData.isIntercepting() in that it checks for
property access + subclassing in addition to the redefinition /
enhancement checks.

getBroker

getId

Return the identifier for this state manager. This may return a
temporary identifier for new unflushed instances that have not been
assigned an object id, or for non-persistent or embedded instances.
For all other instances this method is the same as OpenJPAStateManager.getObjectId().

setObjectId

Set the object id for the managed instance. Some back ends may not be
able to assign a permanent oid until flush. Do not call this method on
application identity instances; changing the primary key fields of
application identity objects through the storeXXXField
methods will automatically change the oid.

setVersion

Set the version indicator for this instance, as loaded from the
data store. This method is used by the StoreManager when
loading instance data. On rollback, the version will be rolled back
to this value. Version objects should be serializable and should not
require vendor-specific classes, because they are transferred to
detached objects.

setImplData

Field-level impl data. Field-level data only applies to loaded fields,
and is cleared when the field is cleared. Whether the data is cached
across instances depends on the corresponding field metadata's response
to FieldMetaData.usesImplData().

getIntermediate

Use intermediate field data to store intermediate information that
might be available before the field is fully loaded. The system
will automatically clear this data when the field gets loaded.
This data should be cacheable; the datastore cache will attempt to
cache it if the field value is not available.

setIntermediate

Use intermediate field data to store intermediate information that
might be available before the field is fully loaded. The system
will automatically clear this data when the field gets loaded.
This data should be cacheable; the datastore cache will attempt to
cache it if the field value is not available.

dirtyCheck

public void dirtyCheck()

Checks whether or not _pc is dirty. In the cases where
field tracking is not happening (see below), this method will do a
state comparison to find whether _pc is dirty, and will
update this instance with this information. In the cases where field
tracking is happening, this method is a no-op.

Fields are tracked for all classes that are run through the OpenJPA
enhancer prior to or during deployment, and all classes (enhanced or
unenhanced) in a Java 6 environment or newer.

In a Java 5 VM or older:
- instances of unenhanced classes that use
property access and obey the property access limitations are tracked
when the instances are loaded from the database by OpenJPA, and are
not tracked when the instances are created by application code.
- instances of unenhanced classes that use field access are
never tracked.

setRemote

Set the given field to the given value. Make the field dirty as
if user code set it. Do not delete dependent objects in the field's
current value. This method is invoked by the remote package to
synch a server-side state manager with remote changes. We do not
need to delete dependent instances because they will have been
deleted when the field changed on the client side, and those
client-side deletes will be transmitted independently.

setUpdateVersion

translate

Translate the given exception based on the broker's implicit behavior.
Translation only occurs if the exception is initiated by a user action
on an instance, and therefore will not be caught and translated by the
broker.