org.apache.openjpa.persistence
Interface OpenJPAEntityManager

All Superinterfaces:
AutoClear, AutoDetach, CallbackModes, Closeable, Connection, ConnectionRetainModes, DetachState, EntityManager, EntityTransaction, LocalTransaction, RestoreState
All Known Implementing Classes:
EntityManagerImpl

public interface OpenJPAEntityManager
extends EntityManager, EntityTransaction, Connection, LocalTransaction, LocalTransaction, Closeable, ConnectionRetainModes, DetachState, RestoreState, AutoDetach, AutoClear, CallbackModes

Interface implemented by OpenJPA entity managers.

Since:
0.4.0
Author:
Abe White

Field Summary
 
Fields inherited from interface org.apache.openjpa.kernel.ConnectionRetainModes
CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS
 
Fields inherited from interface org.apache.openjpa.kernel.DetachState
DETACH_ALL, DETACH_FGS, DETACH_LOADED
 
Fields inherited from interface org.apache.openjpa.kernel.RestoreState
RESTORE_ALL, RESTORE_IMMUTABLE, RESTORE_NONE
 
Fields inherited from interface org.apache.openjpa.kernel.AutoDetach
DETACH_CLOSE, DETACH_COMMIT, DETACH_NONTXREAD
 
Fields inherited from interface org.apache.openjpa.kernel.AutoClear
CLEAR_ALL, CLEAR_DATASTORE
 
Fields inherited from interface org.apache.openjpa.event.CallbackModes
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK
 
Method Summary
 void addLifecycleListener(Object listener, Class... classes)
          Register a listener for lifecycle-related events on the specified classes.
 void addTransactionListener(Object listener)
          Register a listener for transaction-related events.
 void beginStore()
          Begins a store transaction if one isn't already started.
 boolean cancelAll()
          Cancel all pending data store statements.
 void commitAndResume()
          Issue a commit and then start a new transaction.
 boolean containsAll(Collection pcs)
          Whether the given objects are managed.
 boolean containsAll(Object... pcs)
          Whether the given objects are managed.
<T> Extent<T>
createExtent(Class<T> cls, boolean subs)
          Return an extent of the given class, optionally including subclasses.
<T> T
createInstance(Class<T> cls)
          Create a new instance of type cls.
 OpenJPAQuery createNamedQuery(String name)
           
 OpenJPAQuery createNativeQuery(String sql)
           
 OpenJPAQuery createNativeQuery(String sql, Class resultClass)
           
 OpenJPAQuery createNativeQuery(String sql, String resultMapping)
           
 OpenJPAQuery createQuery(Query query)
          Create a new query from the given one.
 OpenJPAQuery createQuery(String query)
           
 OpenJPAQuery createQuery(String language, String query)
          Create a new query in the given language.
<T> T
detach(T pc)
          Detach the specified object from the entity manager.
 Collection detachAll(Collection pcs)
          Detach the specified objects from the entity manager.
 Object[] detachAll(Object... pcs)
          Detach the specified objects from the entity manager.
 void dirty(Object o, String field)
          Make the named field of the given object dirty.
 void dirtyClass(Class cls)
          Mark the given class as dirty within the current transaction.
 void evict(Object pc)
          Evict the given object.
 void evictAll()
          Evict all clean objects.
 void evictAll(Class cls)
          Evict all persistent-clean and persistent-nontransactional instances in the extent of the given class (including subclasses).
 void evictAll(Collection pcs)
          Evict the given objects.
 void evictAll(Extent extent)
          Evict all persistent-clean and persistent-nontransactional instances in the given Extent.
 void evictAll(Object... pcs)
          Evict the given objects.
<T> Collection<T>
findAll(Class<T> cls, Collection oids)
          Return the objects with the given oids.
<T> T[]
findAll(Class<T> cls, Object... oids)
          Return the objects with the given oids.
<T> T
findCached(Class<T> cls, Object oid)
          Return the cached instance for the given oid/object, or null if not cached.
 int getAutoClear()
          Whether to clear state when entering a transaction.
 int getAutoDetach()
          Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.
 ClassLoader getClassLoader()
          Return the current thread's class loader at the time this entity manager was obtained from the factory.
 OpenJPAConfiguration getConfiguration()
          Return the configuration associated with this entity manager.
 Object getConnection()
          Return the connection in use by the entity manager, or a new connection if none.
 String getConnectionPassword()
          Return the connection password.
 int getConnectionRetainMode()
          Return the connection retain mode for this entity manager.
 String getConnectionUserName()
          Return the connection user name.
 int getDetachState()
          Detach mode constant to determine which fields are part of the detached graph.
 Collection getDirtyObjects()
          Return a set of current dirty instances.
 OpenJPAEntityManagerFactory getEntityManagerFactory()
          Return the factory that produced this entity manager.
 boolean getEvictFromStoreCache()
          Whether to also evict an object from the store cache when it is evicted through this entity manager.
 FetchPlan getFetchPlan()
          Return the (mutable) fetch plan for loading objects from this entity manager.
 Generator getFieldGenerator(Class forClass, String fieldName)
          Returns a Generator for the generated values of the specified type, or null if the field is not generated.
 Generator getIdGenerator(Class forClass)
          Returns a Generator for the datastore identity values of the specified type, or null if the type is unmanaged or its identity cannot be represented by a sequence.
 boolean getIgnoreChanges()
          Whether to take into account changes in the transaction when executing a query or iterating an extent.
 int getLifecycleListenerCallbackMode()
          The CallbackModes flags for handling lifecycle listener exceptions.
 LockModeType getLockMode(Object pc)
          Return the lock mode of the given instance, or null if not locked.
 Collection getManagedObjects()
          Return a set of all managed instances.
 ManagedRuntime getManagedRuntime()
          Return the managed runtime in use.
 boolean getMultithreaded()
          Whether the entity manager or its managed instances are used in a multithreaded environment.
 Generator getNamedGenerator(String name)
          Return the named generator defined in the metadata.
 boolean getNontransactionalRead()
          Whether to allow nontransactional access to persistent state.
 boolean getNontransactionalWrite()
          Whether to allow nontransactional changes to persistent state.
 Object getObjectId(Object o)
          Return the oid of the given instance.
 Class getObjectIdClass(Class pcClass)
          Return the application identity class the given persistent class uses for object ids, or null if not a type that uses application identity.
 boolean getOptimistic()
          Whether to use optimistic transactional semantics.
 boolean getOrderDirtyObjects()
          Whether dirty objects will be returned in the order they were dirtied.
 Collection getPendingTransactionalObjects()
          Return a set of instances which will become transactional upon the next transaction.
 Collection<Class> getPersistedClasses()
          Return the set of classes that have been made persistent in the current transaction.
 boolean getPopulateStoreCache()
          Whether objects accessed during this transaction will be added to the store cache.
 Collection<Class> getRemovedClasses()
          Return the set of classes that have been deleted in the current transaction.
 int getRestoreState()
          Whether to restore an object's original state on rollback.
 boolean getRetainState()
          Whether objects retain their persistent state on transaction commit.
 boolean getRollbackOnly()
          Return whether the current transaction has been marked for rollback.
 boolean getSyncWithManagedTransactions()
          Whether to check for a global transaction upon every managed, non-transactional operation.
 Collection getTransactionalObjects()
          Return a set of current transaction instances.
 int getTransactionListenerCallbackMode()
          The CallbackModes flags for handling transaction listener exceptions.
 Collection<Class> getUpdatedClasses()
          Return the set of classes for objects that have been modified in the current transaction.
 Object getUserObject(Object key)
          Get the value for the specified key from the map of user objects.
 Object getVersion(Object o)
          Returns the current version indicator for o.
 boolean isDetached(Object o)
          Returns true if pc is a detached object (one that can be reattached to a EntityManager via a call to EntityManager.merge(T)); otherwise returns false.
 boolean isDirty(Object o)
          Return whether the given object is dirty.
 boolean isLargeTransaction()
          Whether memory usage is reduced during this transaction at the expense of possibly more aggressive data cache evictions.
 boolean isManaged()
          Whether this entity manager is using managed transactions.
 boolean isNewlyPersistent(Object o)
          Return whether the given object was made persistent in the current transaction.
 boolean isPersistent(Object o)
          Return whether the given object is persistent.
 boolean isRemoved(Object o)
          Return whether the given object is deleted.
 boolean isStoreActive()
          Whether a store transaction is active.
 boolean isTransactional(Object o)
          Return whether the given object is transactional.
 void lock(Object pc)
          Ensure that the given instance is locked at the current lock level, as set in the FetchPlan for the entity manager.
 void lock(Object pc, LockModeType mode, int timeout)
          Ensure that the given instance is locked at the given lock level.
 void lockAll(Collection pcs)
          Ensure that the given instances are locked at the current lock level, as set in the FetchPlan for the entity manager.
 void lockAll(Collection pcs, LockModeType mode, int timeout)
          Ensure that the given instances are locked at the given lock level.
 void lockAll(Object... pcs)
          Ensure that the given instances are locked at the current lock level, as set in the FetchPlan for the entity manager.
 void lockAll(Object[] pcs, LockModeType mode, int timeout)
          Ensure that the given instances are locked at the given lock level.
 Collection mergeAll(Collection pcs)
          Merge the specified detached objects into the entity manager.
 Object[] mergeAll(Object... pcs)
          Merge the specified objects into the entity manager.
 void nontransactional(Object pc)
          Make the given object nontransactional.
 void nontransactionalAll(Collection objs)
          Make the given objects nontransactional.
 void nontransactionalAll(Object[] objs)
          Make the given objects nontransactional.
 void persistAll(Collection pcs)
          Persist the given objects.
 void persistAll(Object... pcs)
          Persist the given objects.
 void preFlush()
          Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks.
 Object putUserObject(Object key, Object val)
          Put the specified key-value pair into the map of user objects.
 void refreshAll()
          Refresh all transactional objects.
 void refreshAll(Collection pcs)
          Refresh the state of the given objects.
 void refreshAll(Object... pcs)
          Refresh the state of the given objects.
 void release(Object pc)
          Release the given object from management.
 void releaseAll(Collection pcs)
          Release the given objects from management.
 void releaseAll(Object... pcs)
          Release the given object from management.
 void releaseSavepoint()
          Release the last set savepoint and any resources associated with it.
 void releaseSavepoint(String name)
          Release the savepoint and any resources associated with it.
 void removeAll(Collection pcs)
          Delete the given persistent objects.
 void removeAll(Object... pcs)
          Delete the given persistent objects.
 void removeLifecycleListener(Object listener)
          Remove a listener for lifecycle-related events.
 void removeTransactionListener(Object listener)
          Remove a listener for transaction-related events.
 void retrieve(Object pc)
          Immediately load the given object's persistent fields.
 void retrieveAll(Collection pcs)
          Retrieve the persistent state of the given objects.
 void retrieveAll(Object... pcs)
          Retrieve the persistent state of the given objects.
 void rollbackAndResume()
          Issue a rollback and then start a new transaction.
 void rollbackToSavepoint()
          Rollback the current transaction to the last savepoint.
 void rollbackToSavepoint(String name)
          Rollback the current transaction to the given savepoint name.
 void setAutoClear(int clear)
          Whether to clear state when entering a transaction.
 void setAutoDetach(int flags)
          Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.
 void setAutoDetach(int flag, boolean on)
          Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.
 void setDetachState(int mode)
          Detach mode constant to determine which fields are part of the detached graph.
 void setEvictFromStoreCache(boolean evict)
          Whether to also evict an object from the store cache when it is evicted through this entity manager.
 void setIgnoreChanges(boolean ignore)
          Whether to take into account changes in the transaction when executing a query or iterating an extent.
 void setLargeTransaction(boolean largeTransaction)
          If a large number of objects will be created, modified, or deleted during this transaction setting this option to true will reduce memory usage if you perform periodic flushes.
 void setLifecycleListenerCallbackMode(int callbackMode)
          The CallbackModes flags for handling lifecycle listener exceptions.
 void setMultithreaded(boolean multi)
          Whether the entity manager or its managed instances are used in a multithreaded environment.
 void setNontransactionalRead(boolean read)
          Whether to allow nontransactional access to persistent state.
 void setNontransactionalWrite(boolean write)
          Whether to allow nontransactional changes to persistent state.
 void setOptimistic(boolean opt)
          Whether to use optimistic transactional semantics.
 void setOrderDirtyObjects(boolean order)
          Whether dirty objects will be returned in the order they were dirtied.
 void setPopulateStoreCache(boolean cache)
          Whether to populate the store cache with objects used by this transaction.
 void setRestoreState(int restore)
          Whether to restore an object's original state on rollback.
 void setRetainState(boolean retain)
          Whether objects retain their persistent state on transaction commit.
 void setRollbackOnly()
          Mark the current transaction for rollback.
 void setSavepoint(String name)
          Set a transactional savepoint where operations after this savepoint will be rolled back.
 void setSyncWithManagedTransactions(boolean resync)
          Whether to check for a global transaction upon every managed, non-transactional operation.
 void setTransactionListenerCallbackMode(int callbackMode)
          The CallbackModes flags for handling transaction listener exceptions.
 void transactional(Object pc, boolean updateVersion)
          Make the given object transactional.
 void transactionalAll(Collection objs, boolean updateVersion)
          Make the given objects transactional.
 void transactionalAll(Object[] objs, boolean updateVersion)
          Make the given objects transactional.
 void validateChanges()
          Validate the changes made in this transaction, reporting any optimistic violations, constraint violations, etc.
 
Methods inherited from interface javax.persistence.EntityManager
clear, close, contains, find, flush, getDelegate, getFlushMode, getReference, getTransaction, isOpen, joinTransaction, lock, merge, persist, refresh, remove, setFlushMode
 
Methods inherited from interface javax.persistence.EntityTransaction
begin, commit, isActive, rollback
 
Methods inherited from interface javax.resource.cci.Connection
close, createInteraction, getLocalTransaction, getMetaData, getResultSetInfo
 
Methods inherited from interface javax.resource.cci.LocalTransaction
begin, commit, rollback
 
Methods inherited from interface javax.resource.spi.LocalTransaction
begin, commit, rollback
 
Methods inherited from interface org.apache.openjpa.lib.util.Closeable
close
 

Method Detail

getEntityManagerFactory

OpenJPAEntityManagerFactory getEntityManagerFactory()
Return the factory that produced this entity manager.


getConfiguration

OpenJPAConfiguration getConfiguration()
Return the configuration associated with this entity manager.


getFetchPlan

FetchPlan getFetchPlan()
Return the (mutable) fetch plan for loading objects from this entity manager.


getConnectionRetainMode

int getConnectionRetainMode()
Return the connection retain mode for this entity manager.

See Also:
ConnectionRetainModes

isManaged

boolean isManaged()
Whether this entity manager is using managed transactions.


getManagedRuntime

ManagedRuntime getManagedRuntime()
Return the managed runtime in use.


getSyncWithManagedTransactions

boolean getSyncWithManagedTransactions()
Whether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.


setSyncWithManagedTransactions

void setSyncWithManagedTransactions(boolean resync)
Whether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.


getClassLoader

ClassLoader getClassLoader()
Return the current thread's class loader at the time this entity manager was obtained from the factory.


getConnectionUserName

String getConnectionUserName()
Return the connection user name.


getConnectionPassword

String getConnectionPassword()
Return the connection password.


getMultithreaded

boolean getMultithreaded()
Whether the entity manager or its managed instances are used in a multithreaded environment.


setMultithreaded

void setMultithreaded(boolean multi)
Whether the entity manager or its managed instances are used in a multithreaded environment.


getIgnoreChanges

boolean getIgnoreChanges()
Whether to take into account changes in the transaction when executing a query or iterating an extent.


setIgnoreChanges

void setIgnoreChanges(boolean ignore)
Whether to take into account changes in the transaction when executing a query or iterating an extent.


getNontransactionalRead

boolean getNontransactionalRead()
Whether to allow nontransactional access to persistent state.


setNontransactionalRead

void setNontransactionalRead(boolean read)
Whether to allow nontransactional access to persistent state.


getNontransactionalWrite

boolean getNontransactionalWrite()
Whether to allow nontransactional changes to persistent state.


setNontransactionalWrite

void setNontransactionalWrite(boolean write)
Whether to allow nontransactional changes to persistent state.


getOptimistic

boolean getOptimistic()
Whether to use optimistic transactional semantics.


setOptimistic

void setOptimistic(boolean opt)
Whether to use optimistic transactional semantics.


getRestoreState

int getRestoreState()
Whether to restore an object's original state on rollback.

See Also:
RestoreState

setRestoreState

void setRestoreState(int restore)
Whether to restore an object's original state on rollback.

See Also:
RestoreState

getRetainState

boolean getRetainState()
Whether objects retain their persistent state on transaction commit.


setRetainState

void setRetainState(boolean retain)
Whether objects retain their persistent state on transaction commit.


getDetachState

int getDetachState()
Detach mode constant to determine which fields are part of the detached graph.

See Also:
DetachState

setDetachState

void setDetachState(int mode)
Detach mode constant to determine which fields are part of the detached graph.

See Also:
DetachState

getAutoClear

int getAutoClear()
Whether to clear state when entering a transaction.

See Also:
AutoClear

setAutoClear

void setAutoClear(int clear)
Whether to clear state when entering a transaction.

See Also:
AutoClear

getAutoDetach

int getAutoDetach()
Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.


setAutoDetach

void setAutoDetach(int flags)
Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.


setAutoDetach

void setAutoDetach(int flag,
                   boolean on)
Bit flags marked in AutoDetach which indicate when persistent managed objects should be automatically detached in-place.


getEvictFromStoreCache

boolean getEvictFromStoreCache()
Whether to also evict an object from the store cache when it is evicted through this entity manager.


setEvictFromStoreCache

void setEvictFromStoreCache(boolean evict)
Whether to also evict an object from the store cache when it is evicted through this entity manager.


getPopulateStoreCache

boolean getPopulateStoreCache()
Whether objects accessed during this transaction will be added to the store cache. Defaults to true.

Since:
0.3.4

setPopulateStoreCache

void setPopulateStoreCache(boolean cache)
Whether to populate the store cache with objects used by this transaction. Defaults to true.

Since:
0.3.4

isLargeTransaction

boolean isLargeTransaction()
Whether memory usage is reduced during this transaction at the expense of possibly more aggressive data cache evictions.

Since:
0.3.4

setLargeTransaction

void setLargeTransaction(boolean largeTransaction)
If a large number of objects will be created, modified, or deleted during this transaction setting this option to true will reduce memory usage if you perform periodic flushes.

Since:
0.3.4

putUserObject

Object putUserObject(Object key,
                     Object val)
Put the specified key-value pair into the map of user objects. Use a value of null to remove the key.


getUserObject

Object getUserObject(Object key)
Get the value for the specified key from the map of user objects.


addTransactionListener

void addTransactionListener(Object listener)
Register a listener for transaction-related events.


removeTransactionListener

void removeTransactionListener(Object listener)
Remove a listener for transaction-related events.


getTransactionListenerCallbackMode

int getTransactionListenerCallbackMode()
The CallbackModes flags for handling transaction listener exceptions.


setTransactionListenerCallbackMode

void setTransactionListenerCallbackMode(int callbackMode)
The CallbackModes flags for handling transaction listener exceptions.


addLifecycleListener

void addLifecycleListener(Object listener,
                          Class... classes)
Register a listener for lifecycle-related events on the specified classes. If the classes are null, all events will be propagated to the listener.


removeLifecycleListener

void removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events.


getLifecycleListenerCallbackMode

int getLifecycleListenerCallbackMode()
The CallbackModes flags for handling lifecycle listener exceptions.


setLifecycleListenerCallbackMode

void setLifecycleListenerCallbackMode(int callbackMode)
The CallbackModes flags for handling lifecycle listener exceptions.


findAll

<T> T[] findAll(Class<T> cls,
                Object... oids)
Return the objects with the given oids.

Parameters:
oids - the oids of the objects to return
Returns:
the objects that were looked up, in the same order as the oids parameter.
See Also:
EntityManager.find(Class,Object)

findAll

<T> Collection<T> findAll(Class<T> cls,
                          Collection oids)
Return the objects with the given oids.

Parameters:
oids - the oids of the objects to return
Returns:
the objects that were looked up, in the same order as the oids parameter.
See Also:
EntityManager.find(Class,Object)

findCached

<T> T findCached(Class<T> cls,
                 Object oid)
Return the cached instance for the given oid/object, or null if not cached.

Parameters:
oid - the object's id
Returns:
the cached object, or null if not cached

getObjectIdClass

Class getObjectIdClass(Class pcClass)
Return the application identity class the given persistent class uses for object ids, or null if not a type that uses application identity.


commitAndResume

void commitAndResume()
Issue a commit and then start a new transaction. This is identical to:
 manager.commit (); manager.begin ();
 
except that the entity manager's internal atomic lock is utilized, so this method can be safely executed from multiple threads.

See Also:
EntityTransaction.commit(), EntityTransaction.begin()

rollbackAndResume

void rollbackAndResume()
Issue a rollback and then start a new transaction. This is identical to:
 manager.rollback (); manager.begin ();
 
except that the entity manager's internal atomic lock is utilized, so this method can be safely executed from multiple threads.

See Also:
EntityTransaction.rollback(), EntityTransaction.begin()

setRollbackOnly

void setRollbackOnly()
Mark the current transaction for rollback.

Specified by:
setRollbackOnly in interface EntityTransaction

getRollbackOnly

boolean getRollbackOnly()
Return whether the current transaction has been marked for rollback.

Specified by:
getRollbackOnly in interface EntityTransaction

setSavepoint

void setSavepoint(String name)
Set a transactional savepoint where operations after this savepoint will be rolled back.


rollbackToSavepoint

void rollbackToSavepoint()
Rollback the current transaction to the last savepoint. Savepoints set after this one will become invalid.


rollbackToSavepoint

void rollbackToSavepoint(String name)
Rollback the current transaction to the given savepoint name. Savepoints set after this one will become invalid.


releaseSavepoint

void releaseSavepoint()
Release the last set savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.


releaseSavepoint

void releaseSavepoint(String name)
Release the savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.


preFlush

void preFlush()
Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks. Transaction listeners are not invoked.

Since:
0.3.3

validateChanges

void validateChanges()
Validate the changes made in this transaction, reporting any optimistic violations, constraint violations, etc. In a datastore transaction or a flushed optimistic transaction, this method will act just like EntityManager.flush(). In an optimistic transaction that has not yet begun a datastore-level transaction, however, it will only report exceptions that would occur on flush, without retaining any datastore resources.


isStoreActive

boolean isStoreActive()
Whether a store transaction is active.


beginStore

void beginStore()
Begins a store transaction if one isn't already started. The entity manager must already be in a logical transaction.


containsAll

boolean containsAll(Object... pcs)
Whether the given objects are managed.


containsAll

boolean containsAll(Collection pcs)
Whether the given objects are managed.


persistAll

void persistAll(Object... pcs)
Persist the given objects.


persistAll

void persistAll(Collection pcs)
Persist the given objects.


removeAll

void removeAll(Object... pcs)
Delete the given persistent objects.


removeAll

void removeAll(Collection pcs)
Delete the given persistent objects.


release

void release(Object pc)
Release the given object from management. This operation is not recursive.


releaseAll

void releaseAll(Object... pcs)
Release the given object from management. This operation is not recursive.


releaseAll

void releaseAll(Collection pcs)
Release the given objects from management. This operation is not recursive.


retrieve

void retrieve(Object pc)
Immediately load the given object's persistent fields. One might use this action to make sure that an instance's fields are loaded before transitioning it to transient. Note that this action is not recursive. Any related objects that are loaded will not necessarily have their fields loaded.


retrieveAll

void retrieveAll(Object... pcs)
Retrieve the persistent state of the given objects.

See Also:
retrieve(java.lang.Object)

retrieveAll

void retrieveAll(Collection pcs)
Retrieve the persistent state of the given objects.

See Also:
retrieve(java.lang.Object)

refreshAll

void refreshAll(Object... pcs)
Refresh the state of the given objects.


refreshAll

void refreshAll(Collection pcs)
Refresh the state of the given objects.


refreshAll

void refreshAll()
Refresh all transactional objects.


evict

void evict(Object pc)
Evict the given object.


evictAll

void evictAll(Object... pcs)
Evict the given objects.


evictAll

void evictAll(Collection pcs)
Evict the given objects.


evictAll

void evictAll()
Evict all clean objects.


evictAll

void evictAll(Class cls)
Evict all persistent-clean and persistent-nontransactional instances in the extent of the given class (including subclasses).


evictAll

void evictAll(Extent extent)
Evict all persistent-clean and persistent-nontransactional instances in the given Extent.


detach

<T> T detach(T pc)
Detach the specified object from the entity manager.

Parameters:
pc - the instance to detach
Returns:
the detached instance

detachAll

Collection detachAll(Collection pcs)
Detach the specified objects from the entity manager.

Parameters:
pcs - the instances to detach
Returns:
the detached instances

detachAll

Object[] detachAll(Object... pcs)
Detach the specified objects from the entity manager.

Parameters:
pcs - the instances to detach
Returns:
the detached instances

mergeAll

Object[] mergeAll(Object... pcs)
Merge the specified objects into the entity manager.

Parameters:
pcs - instances to import
Returns:
the re-attached instances

mergeAll

Collection mergeAll(Collection pcs)
Merge the specified detached objects into the entity manager.

Parameters:
pcs - Collection of instances to import
Returns:
the re-attached instances

transactional

void transactional(Object pc,
                   boolean updateVersion)
Make the given object transactional.

Parameters:
pc - instance to make transactional
updateVersion - if true, the instance's version will be incremented at the next flush

transactionalAll

void transactionalAll(Collection objs,
                      boolean updateVersion)
Make the given objects transactional.

Parameters:
objs - instances to make transactional
updateVersion - if true, the instance's version will be incremented at the next flush

transactionalAll

void transactionalAll(Object[] objs,
                      boolean updateVersion)
Make the given objects transactional.

Parameters:
objs - instances to make transactional
updateVersion - if true, the instance's version will be incremented at the next flush

nontransactional

void nontransactional(Object pc)
Make the given object nontransactional.


nontransactionalAll

void nontransactionalAll(Collection objs)
Make the given objects nontransactional.


nontransactionalAll

void nontransactionalAll(Object[] objs)
Make the given objects nontransactional.


getNamedGenerator

Generator getNamedGenerator(String name)
Return the named generator defined in the metadata.


getIdGenerator

Generator getIdGenerator(Class forClass)
Returns a Generator for the datastore identity values of the specified type, or null if the type is unmanaged or its identity cannot be represented by a sequence.


getFieldGenerator

Generator getFieldGenerator(Class forClass,
                            String fieldName)
Returns a Generator for the generated values of the specified type, or null if the field is not generated.


createExtent

<T> Extent<T> createExtent(Class<T> cls,
                           boolean subs)
Return an extent of the given class, optionally including subclasses.


createQuery

OpenJPAQuery createQuery(String query)
Specified by:
createQuery in interface EntityManager

createNamedQuery

OpenJPAQuery createNamedQuery(String name)
Specified by:
createNamedQuery in interface EntityManager

createNativeQuery

OpenJPAQuery createNativeQuery(String sql)
Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

OpenJPAQuery createNativeQuery(String sql,
                               Class resultClass)
Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

OpenJPAQuery createNativeQuery(String sql,
                               String resultMapping)
Specified by:
createNativeQuery in interface EntityManager

createQuery

OpenJPAQuery createQuery(Query query)
Create a new query from the given one.


createQuery

OpenJPAQuery createQuery(String language,
                         String query)
Create a new query in the given language.


getLockMode

LockModeType getLockMode(Object pc)
Return the lock mode of the given instance, or null if not locked.


lock

void lock(Object pc,
          LockModeType mode,
          int timeout)
Ensure that the given instance is locked at the given lock level.

Parameters:
pc - the object to lock
mode - the lock level to use
timeout - the number of milliseconds to wait for the lock before giving up, or -1 for no limit

lock

void lock(Object pc)
Ensure that the given instance is locked at the current lock level, as set in the FetchPlan for the entity manager.


lockAll

void lockAll(Collection pcs,
             LockModeType mode,
             int timeout)
Ensure that the given instances are locked at the given lock level.

Parameters:
pcs - the objects to lock
mode - the lock level to use
timeout - the number of milliseconds to wait for the lock before giving up, or -1 for no limit

lockAll

void lockAll(Collection pcs)
Ensure that the given instances are locked at the current lock level, as set in the FetchPlan for the entity manager.


lockAll

void lockAll(Object[] pcs,
             LockModeType mode,
             int timeout)
Ensure that the given instances are locked at the given lock level.

Parameters:
pcs - the objects to lock
mode - the lock level to use
timeout - the number of milliseconds to wait for the lock before giving up, or -1 for no limit

lockAll

void lockAll(Object... pcs)
Ensure that the given instances are locked at the current lock level, as set in the FetchPlan for the entity manager.


cancelAll

boolean cancelAll()
Cancel all pending data store statements. If statements are cancelled while a flush is in progress, the transaction rollback only flag will be set.

Returns:
true if any statements were cancelled, false otherwise

getConnection

Object getConnection()
Return the connection in use by the entity manager, or a new connection if none.


getManagedObjects

Collection getManagedObjects()
Return a set of all managed instances.


getTransactionalObjects

Collection getTransactionalObjects()
Return a set of current transaction instances.


getPendingTransactionalObjects

Collection getPendingTransactionalObjects()
Return a set of instances which will become transactional upon the next transaction.


getDirtyObjects

Collection getDirtyObjects()
Return a set of current dirty instances.


getOrderDirtyObjects

boolean getOrderDirtyObjects()
Whether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.


setOrderDirtyObjects

void setOrderDirtyObjects(boolean order)
Whether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.


dirtyClass

void dirtyClass(Class cls)
Mark the given class as dirty within the current transaction.


getPersistedClasses

Collection<Class> getPersistedClasses()
Return the set of classes that have been made persistent in the current transaction.


getRemovedClasses

Collection<Class> getRemovedClasses()
Return the set of classes that have been deleted in the current transaction.


getUpdatedClasses

Collection<Class> getUpdatedClasses()
Return the set of classes for objects that have been modified in the current transaction.


createInstance

<T> T createInstance(Class<T> cls)
Create a new instance of type cls. If cls is an interface or an abstract class whose abstract methods follow the JavaBeans convention, this method will create a concrete implementation according to the metadata that defines the class. If cls is a non-final concrete type that has metadata but does not implement PersistenceCapable, this method will create a subclass of the type that does implement PersistenceCapable, following the property-based persistent attribute access rules, or will raise an exception if the class does not meet the requirements for subclassing. Otherwise, this will return an instance of the specified class.


dirty

void dirty(Object o,
           String field)
Make the named field of the given object dirty.


getObjectId

Object getObjectId(Object o)
Return the oid of the given instance.


isDirty

boolean isDirty(Object o)
Return whether the given object is dirty.


isTransactional

boolean isTransactional(Object o)
Return whether the given object is transactional.


isPersistent

boolean isPersistent(Object o)
Return whether the given object is persistent.


isNewlyPersistent

boolean isNewlyPersistent(Object o)
Return whether the given object was made persistent in the current transaction.


isRemoved

boolean isRemoved(Object o)
Return whether the given object is deleted.


isDetached

boolean isDetached(Object o)
Returns true if pc is a detached object (one that can be reattached to a EntityManager via a call to EntityManager.merge(T)); otherwise returns false.


getVersion

Object getVersion(Object o)
Returns the current version indicator for o.



Copyright © 2006 Apache Software Foundation. All Rights Reserved.