FORCE_LOAD_REFRESH

FORCE_LOAD_ALL

setContext

Set a reference to the corresponding context. This method
will be called before the store manager is used. The store manager
is responsible for pulling any necessary configuration data from the
context, including the transaction mode and connection retain mode.

beginOptimistic

void beginOptimistic()

Notification that an optimistic transaction has started. This method
does not replace the begin() method, which will still be called
when a true data store transaction should begin.

rollbackOptimistic

void rollbackOptimistic()

Notification that an optimistic transaction was rolled back before
a data store transaction ever began.

begin

void begin()

Begin a data store transaction. After this method is called,
it is assumed that all further operations are operating in a single
transaction that can be committed or rolled back. If optimistic
transactions are in use, this method will only be called when the
system requires a transactionally consistent connection due to a
user request to flush or commit the transaction. In this case, it
is possible that the optimistic transaction does not have the latest
versions of all instances (i.e. another transaction has modified the
same instances and committed since the optimistic transaction started).
On commit, an exception must be thrown on any attempt to overwrite
data for an instance with an older version.

load

Load the given state manager.
Note that any collection or map types loaded into the state manager
will be proxied with the correct type; therefore the store manager
does not have to load the same concrete collection/map types as the
instance declares. However, array types must be consistent with the
array type stored by the persistence capable instance. If this method
is called during a data store transaction, the instance should be
locked. If the given state manager does not have its version set
already, version information can be loaded if desired through the
OpenJPAStateManager.setVersion(java.lang.Object) method.

Parameters:

sm - the instance to load

fields - set of fields to load; all field indexes in this
set must be loaded; this set is mutable

fetch - the fetch configuration to use when loading
related objects

lockLevel - attempt to load simple fields at this lock level;
relations should be loaded at the read lock level
of the fetch configuration

edata - the current execution data, or null if not
given to the calling method of the broker

load == FORCE_LOAD_NONE &&
stateManager.getPCState () != PCState.HOLLOW: A non-hollow
state manager. Perform the same actions as in exists(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object),
and load additional state if desired. Non-hollow objects will only
be included outside of refresh invocations if a user calls
findAll with the validate
parameter set to true.

Store managers that cannot efficiently batch load can simply test
for these conditions and delegate to the proper methods.

Parameters:

sms - the state manager instances to load

state - the lifecycle state to initialize uninitialized
state managers with; may be null if no uninitialized
instances are included in sms

load - one of the FORCE_LOAD_* constants describing the
fields to force-load if this is a refresh or retrieve action

fetch - the current fetch configuration to use when loading
related objects

edata - the current execution data, or null if not
given to the calling method of the broker

Returns:

a collection of the state manager identities for
which no data store record exists

flush

Flush the given state manager collection to the datastore, returning
a collection of exceptions encountered during flushing.
The given collection may include states that do not require data
store action, such as persistent-clean instances or persistent-dirty
instances that have not been modified since they were last flushed.
For datastore updates and inserts, the dirty, non-flushed fields of
each state should be flushed. New instances without an assigned object
id should be given one via OpenJPAStateManager.setObjectId(java.lang.Object). New
instances with value-strategy fields that have not been assigned yet
should have their fields set. Datastore version information should be
updated during flush, and the state manager's version indicator
updated through the OpenJPAStateManager.setNextVersion(java.lang.Object) method.
The current version will roll over to this next version upon successful
commit.

See Also:

org.apache.openjpa.util.ApplicationIds#assign()

assignObjectId

Assign an object id to the given new instance. Return false if the
instance cannot be assigned an identity because a flush is required
(for example, the identity is determined by the datastore on insert).
For application identity instances, the assigned object id should be
based on field state. The implementation is responsible for using the
proper value strategy according to the instance metadata. This method
is called the first time a user requests the oid of a new instance
before flush.

Parameters:

preFlush - whether this assignment is being requested by the
system as part of pre-flush activities, and can
be ignored if it is more efficient to assign within flush(java.util.Collection)

assignField

Assign a value to the given field. Return false if the value cannot
be assigned because a flush is required (for example, the field value
is determined by the datastore on insert). This method is called the
first time a user requests the value of a field with a value-strategy
on a new instance before flush.

Parameters:

preFlush - whether this assignment is being requested by the
system as part of pre-flush activities, and can
be ignored if it is more efficient to assign within flush(java.util.Collection)

getDataStoreIdType

Return the class used by this StoreManager for datastore identity
values. The given metadata may be null, in which case the return
value should the common datastore identity class for all classes, or
null if this store manager does not use a common identity class.

getClientConnection

Return a connection to the data store suitable for client use. If
this method is called during a data store transaction, thie connection
must be transactional. If no connection is in use, this method should
create one to return.

retainConnection

void retainConnection()

Instruct the store to retain a connection for continued use. This
will be invoked automatically based on the user's configured connection
retain mode.

releaseConnection

void releaseConnection()

Instruct the store to release a retained connection. This
will be invoked automatically based on the user's configured connection
retain mode.

cancelAll

boolean cancelAll()

Cancel all pending data store statements.

Returns:

true if any statements cancelled, false otherwise

Since:

0.3.1

executeExtent

Return a provider for all instances of the given candidate class,
optionally including subclasses. The given candidate may be an
unmapped type with mapped subclasses. If the provider is iterated
within a data store transaction, returned instances should be locked.

newQuery

Return a query implementation suitable for this store. If the query
is iterated within a data store transaction, returned instances should
be locked. Return null if this store does not support native execution
of the given language. OpenJPA can execute JPQL in memory even without
back end support.