Class EntityManagerImpl
- All Implemented Interfaces:
jakarta.persistence.EntityManager
,jakarta.persistence.EntityTransaction
,Externalizable
,Serializable
,FindCallbacks
,OpCallbacks
,Closeable
,OpenJPAEntityManager
,OpenJPAEntityManagerSPI
,OpenJPAEntityTransaction
EntityManager
interface.- Author:
- Patrick Linskey, Abe White
- See Also:
-
Field Summary
Fields inherited from interface org.apache.openjpa.kernel.OpCallbacks
ACT_CASCADE, ACT_NONE, ACT_RUN, OP_ATTACH, OP_DELETE, OP_DETACH, OP_EVICT, OP_LOCK, OP_NONTRANSACTIONAL, OP_PERSIST, OP_REFRESH, OP_RELEASE, OP_RETRIEVE, OP_TRANSACTIONAL
Fields inherited from interface org.apache.openjpa.persistence.OpenJPAEntityManager
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK, CLEAR_ALL, CLEAR_DATASTORE, CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS, DETACH_ALL, DETACH_CLOSE, DETACH_COMMIT, DETACH_FETCH_GROUPS, DETACH_FGS, DETACH_LOADED, DETACH_NONTXREAD, DETACH_ROLLBACK, RESTORE_ALL, RESTORE_IMMUTABLE, RESTORE_NONE
-
Constructor Summary
ConstructorDescriptionEntityManagerImpl
(EntityManagerFactoryImpl factory, Broker broker) Constructor; supply factory and delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.protected void
Throw appropriate exception if close has been invoked but the broker is still open.void
begin()
void
Begins a store transaction if one isn't already started.boolean
Cancel all pending data store statements.void
clear()
void
close()
void
commit()
void
Issue a commit and then start a new transaction.boolean
boolean
containsAll
(Object... entities) Whether the given objects are managed.boolean
containsAll
(Collection entities) Whether the given objects are managed.Create an executable query from a dynamically defined query.<T> jakarta.persistence.EntityGraph<T>
createEntityGraph
(Class<T> rootType) jakarta.persistence.EntityGraph<?>
createEntityGraph
(String graphName) <T> Extent<T>
createExtent
(Class<T> cls, boolean subclasses) Return an extent of the given class, optionally including subclasses.<T> T
createInstance
(Class<T> cls) Create a new instance of typecls
.createNamedQuery
(String name) <T> jakarta.persistence.TypedQuery<T>
createNamedQuery
(String name, Class<T> resultClass) jakarta.persistence.StoredProcedureQuery
createNativeQuery
(String query) createNativeQuery
(String query, Class cls) createNativeQuery
(String query, String mappingName) jakarta.persistence.Query
createQuery
(jakarta.persistence.criteria.CriteriaDelete deleteQuery) <T> jakarta.persistence.TypedQuery<T>
createQuery
(jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) Create a query from the given CritriaQuery.jakarta.persistence.Query
createQuery
(jakarta.persistence.criteria.CriteriaUpdate updateQuery) createQuery
(jakarta.persistence.Query query) Create a new query from the given one.createQuery
(String query) <T> jakarta.persistence.TypedQuery<T>
createQuery
(String query, Class<T> resultClass) createQuery
(String language, String query) Create a new query in the given language.jakarta.persistence.StoredProcedureQuery
createStoredProcedureQuery
(String procedureName) jakarta.persistence.StoredProcedureQuery
createStoredProcedureQuery
(String procedureName, Class... resultClasses) jakarta.persistence.StoredProcedureQuery
createStoredProcedureQuery
(String procedureName, String... resultSetMappings) void
Object[]
Detach the specified objects from the entity manager.detachAll
(Collection entities) Detach the specified objects from the entity manager.<T> T
detachCopy
(T entity) Detach the specified object from the entity manager, detaching based on the AutoDetach value specified and returning a copy of the detached entity.void
Make the named field of the given object dirty.void
dirtyClass
(Class cls) Mark the given class as dirty within the current transaction.boolean
void
Evict the given object.void
evictAll()
Evict all clean objects.void
Evict all persistent-clean and persistent-nontransactional instances in the extent of the given class (including subclasses).void
Evict the given objects.void
evictAll
(Collection entities) Evict the given objects.void
Evict all persistent-clean and persistent-nontransactional instances in the givenExtent
.<T> T
<T> T
<T> T
find
(Class<T> cls, Object oid, jakarta.persistence.LockModeType mode, Map<String, Object> properties) <T> T
<T> T[]
Return the objects with the given oids.<T> Collection<T>
findAll
(Class<T> cls, Collection 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.void
flush()
Whether to clear state when entering a transaction.AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place.Broker delegate.Return the current thread's class loader at the time this entity manager was obtained from the factory.Return the configuration associated with this entity manager.Return the connection in use by the entity manager, or a new connection if none.Return the connection password.Return the connection retain mode for this entity manager.Return the connection user name.Gets the QueryBuilder with OpenJPA-extended capabilities.Detach mode constant to determine which fields are part of the detached graph.Return a set of current dirty instances.jakarta.persistence.EntityGraph<?>
getEntityGraph
(String graphName) <T> List<jakarta.persistence.EntityGraph<? super T>>
getEntityGraphs
(Class<T> entityClass) Return the factory that produced this entity manager.boolean
Whether to also evict an object from the store cache when it is evicted through this entity manager.Return the (mutable) fetch plan for loading objects from this entity manager.getFieldGenerator
(Class forClass, String fieldName) Returns aGenerator
for the generated values of the specified type, or null if the field is not generated.jakarta.persistence.FlushModeType
getIdGenerator
(Class forClass) Returns aGenerator
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
Whether to take into account changes in the transaction when executing a query or iterating an extent.int
TheCallbackMode
flags for handling lifecycle listener exceptions.jakarta.persistence.LockModeType
getLockMode
(Object entity) Return the lock mode of the given instance, or null if not locked.Return a set of all managed instances.Return the managed runtime in use.jakarta.persistence.metamodel.Metamodel
boolean
Whether the entity manager or its managed instances are used in a multithreaded environment.getNamedGenerator
(String name) Return the named generator defined in the metadata.boolean
Whether to allow nontransactional access to persistent state.boolean
Whether to allow nontransactional changes to persistent state.Return the oid of the given instance.getObjectIdClass
(Class cls) Return the application identity class the given persistent class uses for object ids, or null if not a type that uses application identity.boolean
Whether to use optimistic transactional semantics.boolean
Whether dirty objects will be returned in the order they were dirtied.Return a set of instances which will become transactional upon the next transaction.Return the set of classes that have been made persistent in the current transaction.boolean
Whether objects accessed during this transaction will be added to the store cache.Get the properties used currently by this entity manager.boolean
Affirms if this receiver is caching database queries.<T> T
getReference
(Class<T> cls, Object oid) Return the set of classes that have been deleted in the current transaction.Whether to restore an object's original state on rollback.boolean
Whether objects retain their persistent state on transaction commit.Returns the Throwable that caused the transaction to be marked for rollback.boolean
Get the properties supported by this runtime.boolean
Whether to check for a global transaction upon every managed, non-transactional operation.Return a set of current transaction instances.int
TheCallbackMode
flags for handling transaction listener exceptions.Return the set of classes for objects that have been modified in the current transaction.getUserObject
(Object key) Get the value for the specified key from the map of user objects.getVersion
(Object o) Returns the current version indicator foro
.int
hashCode()
boolean
isActive()
boolean
isDetached
(Object entity) Returnstrue
ifpc
is a detached object (one that can be reattached to aEntityManager
via a call toEntityManager.merge(T)
); otherwise returnsfalse
.boolean
Return whether the given object is dirty.boolean
boolean
boolean
boolean
Return whether the given object was made persistent in the current transaction.boolean
isOpen()
boolean
Return whether the given object is persistent.boolean
Return whether the given object is deleted.boolean
Whether a store transaction is active.boolean
Whether memory usage is reduced during this transaction at the expense of tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation.boolean
Return whether the given object is transactional.boolean
Whether this entity manager is using managed transactions.void
void
Ensure that the given instance is locked at the current lock level, as set in theFetchPlan
for the entity manager.void
void
Ensure that the given instance is locked at the given lock level.void
void
Ensure that the given instances are locked at the current lock level, as set in theFetchPlan
for the entity manager.void
Ensure that the given instances are locked at the given lock level.void
lockAll
(Collection entities) Ensure that the given instances are locked at the current lock level, as set in theFetchPlan
for the entity manager.void
lockAll
(Collection entities, jakarta.persistence.LockModeType mode, int timeout) Ensure that the given instances are locked at the given lock level.<T> T
merge
(T entity) Object[]
Merge the specified objects into the entity manager.mergeAll
(Collection entities) Merge the specified detached objects into the entity manager.protected <T> QueryImpl<T>
newQueryImpl
(Query kernelQuery) protected <T> QueryImpl<T>
newQueryImpl
(Query kernelQuery, QueryMetaData qmd) void
nontransactional
(Object entity) Make the given object nontransactional.void
nontransactionalAll
(Object[] objs) Make the given objects nontransactional.void
Make the given objects nontransactional.void
void
persistAll
(Object... entities) Persist the given objects.void
persistAll
(Collection entities) Persist the given objects.void
Pops the fetch plan from the top of the stack, making the next one down the active one.void
preFlush()
Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks.void
Deprecated.int
processArgument
(int op, Object obj, OpenJPAStateManager sm) Process operation argument.processArgument
(Object arg) Process find argument.processReturn
(Object oid, OpenJPAStateManager sm) Process operation return value.Pushes a new fetch plan that inherits from the current fetch plan onto a stack, and makes the new plan the active one.putUserObject
(Object key, Object val) Put the specified key-value pair into the map of user objects.void
void
void
void
void
void
Refresh all transactional objects.void
refreshAll
(Object... entities) Refresh the state of the given objects.void
refreshAll
(Collection entities) Refresh the state of the given objects.void
Release the given object from management.void
releaseAll
(Object... entities) Release the given object from management.void
releaseAll
(Collection entities) Release the given objects from management.void
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
void
Delete the given persistent objects.void
removeAll
(Collection entities) 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
Immediately load the given object's persistent fields.void
retrieveAll
(Object... entities) Retrieve the persistent state of the given objects.void
retrieveAll
(Collection entities) Retrieve the persistent state of the given objects.void
rollback()
void
Issue a rollback and then start a new transaction.void
Rollback the current transaction to the last savepoint.void
rollbackToSavepoint
(String name) Rollback the current transaction to the given savepoint name.void
setAutoClear
(int autoClear) void
Whether to clear state when entering a transaction.void
setAutoDetach
(int autoDetachFlags) void
setAutoDetach
(int flag, boolean on) void
setAutoDetach
(EnumSet<AutoDetachType> flags) AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place.void
setAutoDetach
(AutoDetachType flag) AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place.void
setAutoDetach
(AutoDetachType value, boolean on) Bit flags marked inAutoDetachType
which indicate when persistent managed objects should be automatically detached in-place.void
setDetachState
(int detach) void
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
setFlushMode
(jakarta.persistence.FlushModeType flushMode) void
setIgnoreChanges
(boolean val) Whether to take into account changes in the transaction when executing a query or iterating an extent.void
setLargeTransaction
(boolean value) void
setLifecycleListenerCallbackMode
(int callbackMode) void
TheCallbackMode
flags for handling lifecycle listener exceptions.void
TheCallbackMode
flag for handling lifecycle listener exceptions.void
setMultithreaded
(boolean multithreaded) Whether the entity manager or its managed instances are used in a multithreaded environment.void
setNontransactionalRead
(boolean val) Whether to allow nontransactional access to persistent state.void
setNontransactionalWrite
(boolean val) Whether to allow nontransactional changes to persistent state.void
setOptimistic
(boolean val) 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
setProperties
(Map<String, Object> emEmptyPropsProperties) void
setProperty
(String prop, Object value) Sets the given property to the given value, reflectively.void
setQuerySQLCache
(boolean flag) Sets whether this receiver will cache database queries during its lifetime.void
setRestoreState
(int restore) void
Whether to restore an object's original state on rollback.void
setRetainState
(boolean val) Whether objects retain their persistent state on transaction commit.void
void
setRollbackOnly
(Throwable cause) Mark the current transaction for rollback with the specified cause of the rollback.void
setSavepoint
(String name) Set a transactional savepoint where operations after this savepoint will be rolled back.void
setSyncWithManagedTransactions
(boolean sync) Whether to check for a global transaction upon every managed, non-transactional operation.void
setTrackChangesByType
(boolean trackByType) 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 by tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation.void
setTransactionListenerCallbackMode
(int callbackMode) void
TheCallbackMode
flags for handling transaction listener exceptions.void
TheCallbackMode
flag for handling transaction listener exceptions.void
transactional
(Object entity, boolean updateVersion) Make the given object transactional.void
transactionalAll
(Object[] objs, boolean updateVersion) Make the given objects transactional.void
transactionalAll
(Collection objs, boolean updateVersion) Make the given objects transactional.<T> T
Unwraps this receiver to an instance of the given class, if possible.void
Validate the changes made in this transaction, reporting any optimistic violations, constraint violations, etc.protected void
validateSQL
(String query) Validate that the user provided SQL.void
-
Field Details
-
_ret
-
-
Constructor Details
-
EntityManagerImpl
public EntityManagerImpl() -
EntityManagerImpl
Constructor; supply factory and delegate.
-
-
Method Details
-
getBroker
Broker delegate. -
getEntityManagerFactory
Description copied from interface:OpenJPAEntityManager
Return the factory that produced this entity manager.- Specified by:
getEntityManagerFactory
in interfacejakarta.persistence.EntityManager
- Specified by:
getEntityManagerFactory
in interfaceOpenJPAEntityManager
-
getConfiguration
Description copied from interface:OpenJPAEntityManagerSPI
Return the configuration associated with this entity manager.- Specified by:
getConfiguration
in interfaceOpenJPAEntityManager
- Specified by:
getConfiguration
in interfaceOpenJPAEntityManagerSPI
-
getFetchPlan
Description copied from interface:OpenJPAEntityManager
Return the (mutable) fetch plan for loading objects from this entity manager.- Specified by:
getFetchPlan
in interfaceOpenJPAEntityManager
-
pushFetchPlan
Description copied from interface:OpenJPAEntityManager
Pushes a new fetch plan that inherits from the current fetch plan onto a stack, and makes the new plan the active one.- Specified by:
pushFetchPlan
in interfaceOpenJPAEntityManager
- Returns:
- the new fetch plan
-
pushFetchPlan
-
popFetchPlan
public void popFetchPlan()Description copied from interface:OpenJPAEntityManager
Pops the fetch plan from the top of the stack, making the next one down the active one. This returns void to avoid confusion, since fetch plans tend to be used in method-chaining patterns often.- Specified by:
popFetchPlan
in interfaceOpenJPAEntityManager
-
getConnectionRetainMode
Description copied from interface:OpenJPAEntityManager
Return the connection retain mode for this entity manager.- Specified by:
getConnectionRetainMode
in interfaceOpenJPAEntityManager
-
isTransactionManaged
public boolean isTransactionManaged()Description copied from interface:OpenJPAEntityManager
Whether this entity manager is using managed transactions.- Specified by:
isTransactionManaged
in interfaceOpenJPAEntityManager
-
isManaged
public boolean isManaged()- Specified by:
isManaged
in interfaceOpenJPAEntityManager
-
getManagedRuntime
Description copied from interface:OpenJPAEntityManagerSPI
Return the managed runtime in use.- Specified by:
getManagedRuntime
in interfaceOpenJPAEntityManagerSPI
-
getSyncWithManagedTransactions
public boolean getSyncWithManagedTransactions()Description copied from interface:OpenJPAEntityManager
Whether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.- Specified by:
getSyncWithManagedTransactions
in interfaceOpenJPAEntityManager
-
setSyncWithManagedTransactions
public void setSyncWithManagedTransactions(boolean sync) Description copied from interface:OpenJPAEntityManager
Whether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.- Specified by:
setSyncWithManagedTransactions
in interfaceOpenJPAEntityManager
-
getClassLoader
Description copied from interface:OpenJPAEntityManager
Return the current thread's class loader at the time this entity manager was obtained from the factory.- Specified by:
getClassLoader
in interfaceOpenJPAEntityManager
-
getConnectionUserName
Description copied from interface:OpenJPAEntityManager
Return the connection user name.- Specified by:
getConnectionUserName
in interfaceOpenJPAEntityManager
-
getConnectionPassword
Description copied from interface:OpenJPAEntityManager
Return the connection password.- Specified by:
getConnectionPassword
in interfaceOpenJPAEntityManager
-
getMultithreaded
public boolean getMultithreaded()Description copied from interface:OpenJPAEntityManager
Whether the entity manager or its managed instances are used in a multithreaded environment.- Specified by:
getMultithreaded
in interfaceOpenJPAEntityManager
-
setMultithreaded
public void setMultithreaded(boolean multithreaded) Description copied from interface:OpenJPAEntityManager
Whether the entity manager or its managed instances are used in a multithreaded environment.- Specified by:
setMultithreaded
in interfaceOpenJPAEntityManager
-
getIgnoreChanges
public boolean getIgnoreChanges()Description copied from interface:OpenJPAEntityManager
Whether to take into account changes in the transaction when executing a query or iterating an extent.- Specified by:
getIgnoreChanges
in interfaceOpenJPAEntityManager
-
setIgnoreChanges
public void setIgnoreChanges(boolean val) Description copied from interface:OpenJPAEntityManager
Whether to take into account changes in the transaction when executing a query or iterating an extent.- Specified by:
setIgnoreChanges
in interfaceOpenJPAEntityManager
-
getNontransactionalRead
public boolean getNontransactionalRead()Description copied from interface:OpenJPAEntityManager
Whether to allow nontransactional access to persistent state.- Specified by:
getNontransactionalRead
in interfaceOpenJPAEntityManager
-
setNontransactionalRead
public void setNontransactionalRead(boolean val) Description copied from interface:OpenJPAEntityManager
Whether to allow nontransactional access to persistent state.- Specified by:
setNontransactionalRead
in interfaceOpenJPAEntityManager
-
getNontransactionalWrite
public boolean getNontransactionalWrite()Description copied from interface:OpenJPAEntityManager
Whether to allow nontransactional changes to persistent state.- Specified by:
getNontransactionalWrite
in interfaceOpenJPAEntityManager
-
setNontransactionalWrite
public void setNontransactionalWrite(boolean val) Description copied from interface:OpenJPAEntityManager
Whether to allow nontransactional changes to persistent state.- Specified by:
setNontransactionalWrite
in interfaceOpenJPAEntityManager
-
getOptimistic
public boolean getOptimistic()Description copied from interface:OpenJPAEntityManager
Whether to use optimistic transactional semantics.- Specified by:
getOptimistic
in interfaceOpenJPAEntityManager
-
setOptimistic
public void setOptimistic(boolean val) Description copied from interface:OpenJPAEntityManager
Whether to use optimistic transactional semantics.- Specified by:
setOptimistic
in interfaceOpenJPAEntityManager
-
getRestoreState
Description copied from interface:OpenJPAEntityManager
Whether to restore an object's original state on rollback.- Specified by:
getRestoreState
in interfaceOpenJPAEntityManager
-
setRestoreState
Description copied from interface:OpenJPAEntityManager
Whether to restore an object's original state on rollback.- Specified by:
setRestoreState
in interfaceOpenJPAEntityManager
-
setRestoreState
public void setRestoreState(int restore) - Specified by:
setRestoreState
in interfaceOpenJPAEntityManager
-
getRetainState
public boolean getRetainState()Description copied from interface:OpenJPAEntityManager
Whether objects retain their persistent state on transaction commit.- Specified by:
getRetainState
in interfaceOpenJPAEntityManager
-
setRetainState
public void setRetainState(boolean val) Description copied from interface:OpenJPAEntityManager
Whether objects retain their persistent state on transaction commit.- Specified by:
setRetainState
in interfaceOpenJPAEntityManager
-
getAutoClear
Description copied from interface:OpenJPAEntityManager
Whether to clear state when entering a transaction.- Specified by:
getAutoClear
in interfaceOpenJPAEntityManager
-
setAutoClear
Description copied from interface:OpenJPAEntityManager
Whether to clear state when entering a transaction.- Specified by:
setAutoClear
in interfaceOpenJPAEntityManager
-
setAutoClear
public void setAutoClear(int autoClear) - Specified by:
setAutoClear
in interfaceOpenJPAEntityManager
-
getDetachState
Description copied from interface:OpenJPAEntityManager
Detach mode constant to determine which fields are part of the detached graph.- Specified by:
getDetachState
in interfaceOpenJPAEntityManager
-
setDetachState
Description copied from interface:OpenJPAEntityManager
Detach mode constant to determine which fields are part of the detached graph.- Specified by:
setDetachState
in interfaceOpenJPAEntityManager
-
setDetachState
public void setDetachState(int detach) - Specified by:
setDetachState
in interfaceOpenJPAEntityManager
-
getAutoDetach
Description copied from interface:OpenJPAEntityManager
AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place.- Specified by:
getAutoDetach
in interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManager
AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place. The current value is replaced in its entirety.- Specified by:
setAutoDetach
in interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManager
AutoDetachType
values which indicate when persistent managed objects should be automatically detached in-place. The current value is replaced in its entirety.- Specified by:
setAutoDetach
in interfaceOpenJPAEntityManager
-
setAutoDetach
public void setAutoDetach(int autoDetachFlags) - Specified by:
setAutoDetach
in interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManager
Bit flags marked inAutoDetachType
which indicate when persistent managed objects should be automatically detached in-place.- Specified by:
setAutoDetach
in interfaceOpenJPAEntityManager
-
setAutoDetach
public void setAutoDetach(int flag, boolean on) - Specified by:
setAutoDetach
in interfaceOpenJPAEntityManager
-
getEvictFromStoreCache
public boolean getEvictFromStoreCache()Description copied from interface:OpenJPAEntityManager
Whether to also evict an object from the store cache when it is evicted through this entity manager.- Specified by:
getEvictFromStoreCache
in interfaceOpenJPAEntityManager
-
setEvictFromStoreCache
public void setEvictFromStoreCache(boolean evict) Description copied from interface:OpenJPAEntityManager
Whether to also evict an object from the store cache when it is evicted through this entity manager.- Specified by:
setEvictFromStoreCache
in interfaceOpenJPAEntityManager
-
getPopulateStoreCache
public boolean getPopulateStoreCache()Description copied from interface:OpenJPAEntityManager
Whether objects accessed during this transaction will be added to the store cache. Defaults to true.- Specified by:
getPopulateStoreCache
in interfaceOpenJPAEntityManager
-
setPopulateStoreCache
public void setPopulateStoreCache(boolean cache) Description copied from interface:OpenJPAEntityManager
Whether to populate the store cache with objects used by this transaction. Defaults to true.- Specified by:
setPopulateStoreCache
in interfaceOpenJPAEntityManager
-
isTrackChangesByType
public boolean isTrackChangesByType()Description copied from interface:OpenJPAEntityManager
Whether memory usage is reduced during this transaction at the expense of tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation.- Specified by:
isTrackChangesByType
in interfaceOpenJPAEntityManager
-
setTrackChangesByType
public void setTrackChangesByType(boolean trackByType) Description copied from interface:OpenJPAEntityManager
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 by tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation.- Specified by:
setTrackChangesByType
in interfaceOpenJPAEntityManager
-
isLargeTransaction
public boolean isLargeTransaction()- Specified by:
isLargeTransaction
in interfaceOpenJPAEntityManager
-
setLargeTransaction
public void setLargeTransaction(boolean value) - Specified by:
setLargeTransaction
in interfaceOpenJPAEntityManager
-
getUserObject
Description copied from interface:OpenJPAEntityManager
Get the value for the specified key from the map of user objects.- Specified by:
getUserObject
in interfaceOpenJPAEntityManager
-
putUserObject
Description copied from interface:OpenJPAEntityManager
Put the specified key-value pair into the map of user objects. Use a value of null to remove the key.- Specified by:
putUserObject
in interfaceOpenJPAEntityManager
-
addTransactionListener
Description copied from interface:OpenJPAEntityManagerSPI
Register a listener for transaction-related events.- Specified by:
addTransactionListener
in interfaceOpenJPAEntityManager
- Specified by:
addTransactionListener
in interfaceOpenJPAEntityManagerSPI
-
removeTransactionListener
Description copied from interface:OpenJPAEntityManagerSPI
Remove a listener for transaction-related events.- Specified by:
removeTransactionListener
in interfaceOpenJPAEntityManager
- Specified by:
removeTransactionListener
in interfaceOpenJPAEntityManagerSPI
-
getTransactionListenerCallbackModes
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flags for handling transaction listener exceptions.- Specified by:
getTransactionListenerCallbackModes
in interfaceOpenJPAEntityManagerSPI
-
setTransactionListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flag for handling transaction listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setTransactionListenerCallbackMode
in interfaceOpenJPAEntityManagerSPI
-
setTransactionListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flags for handling transaction listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setTransactionListenerCallbackMode
in interfaceOpenJPAEntityManagerSPI
-
getTransactionListenerCallbackMode
public int getTransactionListenerCallbackMode()- Specified by:
getTransactionListenerCallbackMode
in interfaceOpenJPAEntityManager
-
setTransactionListenerCallbackMode
public void setTransactionListenerCallbackMode(int callbackMode) - Specified by:
setTransactionListenerCallbackMode
in interfaceOpenJPAEntityManager
-
addLifecycleListener
Description copied from interface:OpenJPAEntityManagerSPI
Register a listener for lifecycle-related events on the specified classes. If the classes are null, all events will be propagated to the listener.- Specified by:
addLifecycleListener
in interfaceOpenJPAEntityManager
- Specified by:
addLifecycleListener
in interfaceOpenJPAEntityManagerSPI
-
removeLifecycleListener
Description copied from interface:OpenJPAEntityManagerSPI
Remove a listener for lifecycle-related events.- Specified by:
removeLifecycleListener
in interfaceOpenJPAEntityManager
- Specified by:
removeLifecycleListener
in interfaceOpenJPAEntityManagerSPI
-
getLifecycleListenerCallbackModes
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flags for handling lifecycle listener exceptions.- Specified by:
getLifecycleListenerCallbackModes
in interfaceOpenJPAEntityManagerSPI
-
setLifecycleListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flag for handling lifecycle listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setLifecycleListenerCallbackMode
in interfaceOpenJPAEntityManagerSPI
-
setLifecycleListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPI
TheCallbackMode
flags for handling lifecycle listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setLifecycleListenerCallbackMode
in interfaceOpenJPAEntityManagerSPI
-
getLifecycleListenerCallbackMode
public int getLifecycleListenerCallbackMode()- Specified by:
getLifecycleListenerCallbackMode
in interfaceOpenJPAEntityManager
-
setLifecycleListenerCallbackMode
public void setLifecycleListenerCallbackMode(int callbackMode) - Specified by:
setLifecycleListenerCallbackMode
in interfaceOpenJPAEntityManager
-
getReference
- Specified by:
getReference
in interfacejakarta.persistence.EntityManager
-
find
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
public <T> T find(Class<T> cls, Object oid, jakarta.persistence.LockModeType mode, Map<String, Object> properties) - Specified by:
find
in interfacejakarta.persistence.EntityManager
-
findAll
Description copied from interface:OpenJPAEntityManager
Return the objects with the given oids.- Specified by:
findAll
in interfaceOpenJPAEntityManager
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
Description copied from interface:OpenJPAEntityManager
Return the objects with the given oids.- Specified by:
findAll
in interfaceOpenJPAEntityManager
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
Description copied from interface:OpenJPAEntityManager
Return the cached instance for the given oid/object, or null if not cached.- Specified by:
findCached
in interfaceOpenJPAEntityManager
oid
- the object's id- Returns:
- the cached object, or null if not cached
-
getObjectIdClass
Description copied from interface:OpenJPAEntityManager
Return the application identity class the given persistent class uses for object ids, or null if not a type that uses application identity.- Specified by:
getObjectIdClass
in interfaceOpenJPAEntityManager
-
getTransaction
- Specified by:
getTransaction
in interfacejakarta.persistence.EntityManager
- Specified by:
getTransaction
in interfaceOpenJPAEntityManager
-
joinTransaction
public void joinTransaction()- Specified by:
joinTransaction
in interfacejakarta.persistence.EntityManager
-
isJoinedToTransaction
public boolean isJoinedToTransaction()- Specified by:
isJoinedToTransaction
in interfacejakarta.persistence.EntityManager
-
begin
public void begin()- Specified by:
begin
in interfacejakarta.persistence.EntityTransaction
- Specified by:
begin
in interfaceOpenJPAEntityManager
-
commit
public void commit()- Specified by:
commit
in interfacejakarta.persistence.EntityTransaction
- Specified by:
commit
in interfaceOpenJPAEntityManager
-
rollback
public void rollback()- Specified by:
rollback
in interfacejakarta.persistence.EntityTransaction
- Specified by:
rollback
in interfaceOpenJPAEntityManager
-
commitAndResume
public void commitAndResume()Description copied from interface:OpenJPAEntityTransaction
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.- Specified by:
commitAndResume
in interfaceOpenJPAEntityManager
- Specified by:
commitAndResume
in interfaceOpenJPAEntityTransaction
- See Also:
-
EntityTransaction.commit()
EntityTransaction.begin()
-
rollbackAndResume
public void rollbackAndResume()Description copied from interface:OpenJPAEntityTransaction
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.- Specified by:
rollbackAndResume
in interfaceOpenJPAEntityManager
- Specified by:
rollbackAndResume
in interfaceOpenJPAEntityTransaction
- See Also:
-
EntityTransaction.rollback()
EntityTransaction.begin()
-
getRollbackCause
Description copied from interface:OpenJPAEntityTransaction
Returns the Throwable that caused the transaction to be marked for rollback.- Specified by:
getRollbackCause
in interfaceOpenJPAEntityManager
- Specified by:
getRollbackCause
in interfaceOpenJPAEntityTransaction
- Returns:
- the Throwable, or null if none was given
-
getRollbackOnly
public boolean getRollbackOnly()- Specified by:
getRollbackOnly
in interfacejakarta.persistence.EntityTransaction
- Specified by:
getRollbackOnly
in interfaceOpenJPAEntityManager
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnly
in interfacejakarta.persistence.EntityTransaction
- Specified by:
setRollbackOnly
in interfaceOpenJPAEntityManager
-
setRollbackOnly
Description copied from interface:OpenJPAEntityTransaction
Mark the current transaction for rollback with the specified cause of the rollback.- Specified by:
setRollbackOnly
in interfaceOpenJPAEntityManager
- Specified by:
setRollbackOnly
in interfaceOpenJPAEntityTransaction
-
setSavepoint
Description copied from interface:OpenJPAEntityManager
Set a transactional savepoint where operations after this savepoint will be rolled back.- Specified by:
setSavepoint
in interfaceOpenJPAEntityManager
-
rollbackToSavepoint
public void rollbackToSavepoint()Description copied from interface:OpenJPAEntityManager
Rollback the current transaction to the last savepoint. Savepoints set after this one will become invalid.- Specified by:
rollbackToSavepoint
in interfaceOpenJPAEntityManager
-
rollbackToSavepoint
Description copied from interface:OpenJPAEntityManager
Rollback the current transaction to the given savepoint name. Savepoints set after this one will become invalid.- Specified by:
rollbackToSavepoint
in interfaceOpenJPAEntityManager
-
releaseSavepoint
public void releaseSavepoint()Description copied from interface:OpenJPAEntityManager
Release the last set savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.- Specified by:
releaseSavepoint
in interfaceOpenJPAEntityManager
-
releaseSavepoint
Description copied from interface:OpenJPAEntityManager
Release the savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.- Specified by:
releaseSavepoint
in interfaceOpenJPAEntityManager
-
flush
public void flush()- Specified by:
flush
in interfacejakarta.persistence.EntityManager
-
preFlush
public void preFlush()Description copied from interface:OpenJPAEntityManager
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.- Specified by:
preFlush
in interfaceOpenJPAEntityManager
-
validateChanges
public void validateChanges()Description copied from interface:OpenJPAEntityManager
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 likeEntityManager.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.- Specified by:
validateChanges
in interfaceOpenJPAEntityManager
-
isActive
public boolean isActive()- Specified by:
isActive
in interfacejakarta.persistence.EntityTransaction
- Specified by:
isActive
in interfaceOpenJPAEntityManager
-
isStoreActive
public boolean isStoreActive()Description copied from interface:OpenJPAEntityManager
Whether a store transaction is active.- Specified by:
isStoreActive
in interfaceOpenJPAEntityManager
-
beginStore
public void beginStore()Description copied from interface:OpenJPAEntityManager
Begins a store transaction if one isn't already started. The entity manager must already be in a logical transaction.- Specified by:
beginStore
in interfaceOpenJPAEntityManager
-
contains
- Specified by:
contains
in interfacejakarta.persistence.EntityManager
-
containsAll
Description copied from interface:OpenJPAEntityManager
Whether the given objects are managed.- Specified by:
containsAll
in interfaceOpenJPAEntityManager
-
containsAll
Description copied from interface:OpenJPAEntityManager
Whether the given objects are managed.- Specified by:
containsAll
in interfaceOpenJPAEntityManager
-
persist
- Specified by:
persist
in interfacejakarta.persistence.EntityManager
-
persistAll
Description copied from interface:OpenJPAEntityManager
Persist the given objects.- Specified by:
persistAll
in interfaceOpenJPAEntityManager
-
persistAll
Description copied from interface:OpenJPAEntityManager
Persist the given objects.- Specified by:
persistAll
in interfaceOpenJPAEntityManager
-
remove
- Specified by:
remove
in interfacejakarta.persistence.EntityManager
-
removeAll
Description copied from interface:OpenJPAEntityManager
Delete the given persistent objects.- Specified by:
removeAll
in interfaceOpenJPAEntityManager
-
removeAll
Description copied from interface:OpenJPAEntityManager
Delete the given persistent objects.- Specified by:
removeAll
in interfaceOpenJPAEntityManager
-
release
Description copied from interface:OpenJPAEntityManager
Release the given object from management. This operation is not recursive.- Specified by:
release
in interfaceOpenJPAEntityManager
-
releaseAll
Description copied from interface:OpenJPAEntityManager
Release the given objects from management. This operation is not recursive.- Specified by:
releaseAll
in interfaceOpenJPAEntityManager
-
releaseAll
Description copied from interface:OpenJPAEntityManager
Release the given object from management. This operation is not recursive.- Specified by:
releaseAll
in interfaceOpenJPAEntityManager
-
refresh
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refresh
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refresh
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refresh
public void refresh(Object entity, jakarta.persistence.LockModeType mode, Map<String, Object> properties) - Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refreshAll
public void refreshAll()Description copied from interface:OpenJPAEntityManager
Refresh all transactional objects.- Specified by:
refreshAll
in interfaceOpenJPAEntityManager
-
refreshAll
Description copied from interface:OpenJPAEntityManager
Refresh the state of the given objects.- Specified by:
refreshAll
in interfaceOpenJPAEntityManager
-
refreshAll
Description copied from interface:OpenJPAEntityManager
Refresh the state of the given objects.- Specified by:
refreshAll
in interfaceOpenJPAEntityManager
-
retrieve
Description copied from interface:OpenJPAEntityManager
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.- Specified by:
retrieve
in interfaceOpenJPAEntityManager
-
retrieveAll
Description copied from interface:OpenJPAEntityManager
Retrieve the persistent state of the given objects.- Specified by:
retrieveAll
in interfaceOpenJPAEntityManager
- See Also:
-
retrieveAll
Description copied from interface:OpenJPAEntityManager
Retrieve the persistent state of the given objects.- Specified by:
retrieveAll
in interfaceOpenJPAEntityManager
- See Also:
-
evict
Description copied from interface:OpenJPAEntityManager
Evict the given object.
Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evict
in interfaceOpenJPAEntityManager
- Parameters:
entity
- A persistent class which will be evicted
-
evictAll
Description copied from interface:OpenJPAEntityManager
Evict the given objects.
Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evictAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- A collection of persistent classes which will be evicted.
-
evictAll
Description copied from interface:OpenJPAEntityManager
Evict the given objects.
Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evictAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- The persistent classes which will be evicted
-
evictAll
public void evictAll()Description copied from interface:OpenJPAEntityManager
Evict all clean objects.
Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evictAll
in interfaceOpenJPAEntityManager
-
evictAll
Description copied from interface:OpenJPAEntityManager
Evict all persistent-clean and persistent-nontransactional instances in the extent of the given class (including subclasses).
Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evictAll
in interfaceOpenJPAEntityManager
- Parameters:
cls
- All clean instances of this class will be evicted.
-
evictAll
Description copied from interface:OpenJPAEntityManager
Evict all persistent-clean and persistent-nontransactional instances in the given
Extent
.Eviction acts as a hint to the persistence provider, and indicates that the persistent object is no longer needed by the application and may be garbage collected. It does not remove the object from the L1 cache and only affects objects which are managed and unmodified.
- Specified by:
evictAll
in interfaceOpenJPAEntityManager
- Parameters:
extent
- Extend which contains the persistent classes to evict.
-
detachCopy
public <T> T detachCopy(T entity) Description copied from interface:OpenJPAEntityManager
Detach the specified object from the entity manager, detaching based on the AutoDetach value specified and returning a copy of the detached entity.- Specified by:
detachCopy
in interfaceOpenJPAEntityManager
- Parameters:
entity
- the instance to detach- Returns:
- the detached instance
-
detachAll
Description copied from interface:OpenJPAEntityManager
Detach the specified objects from the entity manager.- Specified by:
detachAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- the instances to detach- Returns:
- the detached instances
-
detachAll
Description copied from interface:OpenJPAEntityManager
Detach the specified objects from the entity manager.- Specified by:
detachAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- the instances to detach- Returns:
- the detached instances
-
merge
public <T> T merge(T entity) - Specified by:
merge
in interfacejakarta.persistence.EntityManager
-
mergeAll
Description copied from interface:OpenJPAEntityManager
Merge the specified objects into the entity manager.- Specified by:
mergeAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- instances to import- Returns:
- the re-attached instances
-
mergeAll
Description copied from interface:OpenJPAEntityManager
Merge the specified detached objects into the entity manager.- Specified by:
mergeAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- Collection of instances to import- Returns:
- the re-attached instances
-
transactional
Description copied from interface:OpenJPAEntityManager
Make the given object transactional.- Specified by:
transactional
in interfaceOpenJPAEntityManager
- Parameters:
entity
- instance to make transactionalupdateVersion
- if true, the instance's version will be incremented at the next flush
-
transactionalAll
Description copied from interface:OpenJPAEntityManager
Make the given objects transactional.- Specified by:
transactionalAll
in interfaceOpenJPAEntityManager
- Parameters:
objs
- instances to make transactionalupdateVersion
- if true, the instance's version will be incremented at the next flush
-
transactionalAll
Description copied from interface:OpenJPAEntityManager
Make the given objects transactional.- Specified by:
transactionalAll
in interfaceOpenJPAEntityManager
- Parameters:
objs
- instances to make transactionalupdateVersion
- if true, the instance's version will be incremented at the next flush
-
nontransactional
Description copied from interface:OpenJPAEntityManager
Make the given object nontransactional.- Specified by:
nontransactional
in interfaceOpenJPAEntityManager
-
nontransactionalAll
Description copied from interface:OpenJPAEntityManager
Make the given objects nontransactional.- Specified by:
nontransactionalAll
in interfaceOpenJPAEntityManager
-
nontransactionalAll
Description copied from interface:OpenJPAEntityManager
Make the given objects nontransactional.- Specified by:
nontransactionalAll
in interfaceOpenJPAEntityManager
-
getNamedGenerator
Description copied from interface:OpenJPAEntityManager
Return the named generator defined in the metadata.- Specified by:
getNamedGenerator
in interfaceOpenJPAEntityManager
-
getIdGenerator
Description copied from interface:OpenJPAEntityManager
Returns aGenerator
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.- Specified by:
getIdGenerator
in interfaceOpenJPAEntityManager
-
getFieldGenerator
Description copied from interface:OpenJPAEntityManager
Returns aGenerator
for the generated values of the specified type, or null if the field is not generated.- Specified by:
getFieldGenerator
in interfaceOpenJPAEntityManager
-
createExtent
Description copied from interface:OpenJPAEntityManager
Return an extent of the given class, optionally including subclasses.- Specified by:
createExtent
in interfaceOpenJPAEntityManager
-
createQuery
- Specified by:
createQuery
in interfacejakarta.persistence.EntityManager
-
createQuery
- Specified by:
createQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createQuery
in interfaceOpenJPAEntityManager
-
createQuery
Description copied from interface:OpenJPAEntityManager
Create a new query in the given language.- Specified by:
createQuery
in interfaceOpenJPAEntityManager
-
createQuery
Description copied from interface:OpenJPAEntityManager
Create a new query from the given one.- Specified by:
createQuery
in interfaceOpenJPAEntityManager
-
createNamedQuery
- Specified by:
createNamedQuery
in interfacejakarta.persistence.EntityManager
-
createNamedQuery
- Specified by:
createNamedQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createNamedQuery
in interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createNativeQuery
in interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createNativeQuery
in interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createNativeQuery
in interfaceOpenJPAEntityManager
-
createNamedStoredProcedureQuery
- Specified by:
createNamedStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
- Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
public jakarta.persistence.StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) - Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
public jakarta.persistence.StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings) - Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
-
newQueryImpl
-
newQueryImpl
-
validateSQL
Validate that the user provided SQL. -
setFlushMode
public void setFlushMode(jakarta.persistence.FlushModeType flushMode) - Specified by:
setFlushMode
in interfacejakarta.persistence.EntityManager
-
getFlushMode
public jakarta.persistence.FlushModeType getFlushMode()- Specified by:
getFlushMode
in interfacejakarta.persistence.EntityManager
-
prepareForPooling
Deprecated.- useclear()
instead.Used by Java EE Containers that wish to pool OpenJPA EntityManagers. The specification doesn't allow the closing of connections with the clear() method. By introducing this new method, we can do additional processing (and maybe more efficient processing) to properly prepare an EM for pooling. -
clear
public void clear()- Specified by:
clear
in interfacejakarta.persistence.EntityManager
-
getDelegate
- Specified by:
getDelegate
in interfacejakarta.persistence.EntityManager
-
getLockMode
Description copied from interface:OpenJPAEntityManager
Return the lock mode of the given instance, or null if not locked.- Specified by:
getLockMode
in interfacejakarta.persistence.EntityManager
- Specified by:
getLockMode
in interfaceOpenJPAEntityManager
-
lock
- Specified by:
lock
in interfacejakarta.persistence.EntityManager
-
lock
Description copied from interface:OpenJPAEntityManager
Ensure that the given instance is locked at the current lock level, as set in theFetchPlan
for the entity manager.- Specified by:
lock
in interfaceOpenJPAEntityManager
-
lock
Description copied from interface:OpenJPAEntityManager
Ensure that the given instance is locked at the given lock level.- Specified by:
lock
in interfaceOpenJPAEntityManager
- Parameters:
entity
- the object to lockmode
- the lock level to usetimeout
- the number of milliseconds to wait for the lock before giving up, or -1 for no limit
-
lock
public void lock(Object entity, jakarta.persistence.LockModeType mode, Map<String, Object> properties) - Specified by:
lock
in interfacejakarta.persistence.EntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManager
Ensure that the given instances are locked at the current lock level, as set in theFetchPlan
for the entity manager.- Specified by:
lockAll
in interfaceOpenJPAEntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManager
Ensure that the given instances are locked at the given lock level.- Specified by:
lockAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- the objects to lockmode
- the lock level to usetimeout
- the number of milliseconds to wait for the lock before giving up, or -1 for no limit
-
lockAll
Description copied from interface:OpenJPAEntityManager
Ensure that the given instances are locked at the current lock level, as set in theFetchPlan
for the entity manager.- Specified by:
lockAll
in interfaceOpenJPAEntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManager
Ensure that the given instances are locked at the given lock level.- Specified by:
lockAll
in interfaceOpenJPAEntityManager
- Parameters:
entities
- the objects to lockmode
- the lock level to usetimeout
- the number of milliseconds to wait for the lock before giving up, or -1 for no limit
-
cancelAll
public boolean cancelAll()Description copied from interface:OpenJPAEntityManager
Cancel all pending data store statements. If statements are cancelled while a flush is in progress, the transaction rollback only flag will be set.- Specified by:
cancelAll
in interfaceOpenJPAEntityManager
- Returns:
- true if any statements were cancelled, false otherwise
-
getConnection
Description copied from interface:OpenJPAEntityManager
Return the connection in use by the entity manager, or a new connection if none.- Specified by:
getConnection
in interfaceOpenJPAEntityManager
-
getManagedObjects
Description copied from interface:OpenJPAEntityManager
Return a set of all managed instances.- Specified by:
getManagedObjects
in interfaceOpenJPAEntityManager
-
getTransactionalObjects
Description copied from interface:OpenJPAEntityManager
Return a set of current transaction instances.- Specified by:
getTransactionalObjects
in interfaceOpenJPAEntityManager
-
getPendingTransactionalObjects
Description copied from interface:OpenJPAEntityManager
Return a set of instances which will become transactional upon the next transaction.- Specified by:
getPendingTransactionalObjects
in interfaceOpenJPAEntityManager
-
getDirtyObjects
Description copied from interface:OpenJPAEntityManager
Return a set of current dirty instances.- Specified by:
getDirtyObjects
in interfaceOpenJPAEntityManager
-
getOrderDirtyObjects
public boolean getOrderDirtyObjects()Description copied from interface:OpenJPAEntityManager
Whether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.- Specified by:
getOrderDirtyObjects
in interfaceOpenJPAEntityManager
-
setOrderDirtyObjects
public void setOrderDirtyObjects(boolean order) Description copied from interface:OpenJPAEntityManager
Whether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.- Specified by:
setOrderDirtyObjects
in interfaceOpenJPAEntityManager
-
dirtyClass
Description copied from interface:OpenJPAEntityManager
Mark the given class as dirty within the current transaction.- Specified by:
dirtyClass
in interfaceOpenJPAEntityManager
-
getPersistedClasses
Description copied from interface:OpenJPAEntityManager
Return the set of classes that have been made persistent in the current transaction.- Specified by:
getPersistedClasses
in interfaceOpenJPAEntityManager
-
getUpdatedClasses
Description copied from interface:OpenJPAEntityManager
Return the set of classes for objects that have been modified in the current transaction.- Specified by:
getUpdatedClasses
in interfaceOpenJPAEntityManager
-
getRemovedClasses
Description copied from interface:OpenJPAEntityManager
Return the set of classes that have been deleted in the current transaction.- Specified by:
getRemovedClasses
in interfaceOpenJPAEntityManager
-
createInstance
Description copied from interface:OpenJPAEntityManager
Create a new instance of typecls
. Ifcls
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. Ifcls
is a non-final concrete type that has metadata but does not implementPersistenceCapable
, this method will create a subclass of the type that does implementPersistenceCapable
, and will attempt to redefine the methods incls
to enable persistent attribute tracking. Otherwise, ifcls
is a managed type, this will return an instance of the specified class.- Specified by:
createInstance
in interfaceOpenJPAEntityManager
-
close
public void close() -
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfacejakarta.persistence.EntityManager
-
dirty
Description copied from interface:OpenJPAEntityManager
Make the named field of the given object dirty.- Specified by:
dirty
in interfaceOpenJPAEntityManager
-
getObjectId
Description copied from interface:OpenJPAEntityManager
Return the oid of the given instance.- Specified by:
getObjectId
in interfaceOpenJPAEntityManager
-
isDirty
Description copied from interface:OpenJPAEntityManager
Return whether the given object is dirty.- Specified by:
isDirty
in interfaceOpenJPAEntityManager
-
isTransactional
Description copied from interface:OpenJPAEntityManager
Return whether the given object is transactional.- Specified by:
isTransactional
in interfaceOpenJPAEntityManager
-
isPersistent
Description copied from interface:OpenJPAEntityManager
Return whether the given object is persistent.- Specified by:
isPersistent
in interfaceOpenJPAEntityManager
-
isNewlyPersistent
Description copied from interface:OpenJPAEntityManager
Return whether the given object was made persistent in the current transaction.- Specified by:
isNewlyPersistent
in interfaceOpenJPAEntityManager
-
isRemoved
Description copied from interface:OpenJPAEntityManager
Return whether the given object is deleted.- Specified by:
isRemoved
in interfaceOpenJPAEntityManager
-
isDetached
Description copied from interface:OpenJPAEntityManager
Returnstrue
ifpc
is a detached object (one that can be reattached to aEntityManager
via a call toEntityManager.merge(T)
); otherwise returnsfalse
.- Specified by:
isDetached
in interfaceOpenJPAEntityManager
-
getVersion
Description copied from interface:OpenJPAEntityManager
Returns the current version indicator foro
.- Specified by:
getVersion
in interfaceOpenJPAEntityManager
-
assertNotCloseInvoked
protected void assertNotCloseInvoked()Throw appropriate exception if close has been invoked but the broker is still open. We test only for this because if the broker is already closed, it will throw its own more informative exception when we delegate the pending operation to it. -
processArgument
Description copied from interface:FindCallbacks
Process find argument. Throw properOpenJPAException
for illegal value.- Specified by:
processArgument
in interfaceFindCallbacks
- Returns:
- the id to look up, or null to ignore this argument
-
processReturn
Description copied from interface:FindCallbacks
Process operation return value.- Specified by:
processReturn
in interfaceFindCallbacks
- Returns:
- the object to return
-
processArgument
Description copied from interface:OpCallbacks
Process operation argument. Throw properOpenJPAException
for illegal value.- Specified by:
processArgument
in interfaceOpCallbacks
- Parameters:
op
- the operation constantobj
- the object passed to the operationsm
- the argument's state manager, or null if none- Returns:
- the action to take on the argument
-
hashCode
public int hashCode() -
equals
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
setProperties
-
detach
- Specified by:
detach
in interfacejakarta.persistence.EntityManager
-
createQuery
public <T> jakarta.persistence.TypedQuery<T> createQuery(jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) Create a query from the given CritriaQuery. Compile to register the parameters in this query.- Specified by:
createQuery
in interfacejakarta.persistence.EntityManager
-
createQuery
public jakarta.persistence.Query createQuery(jakarta.persistence.criteria.CriteriaUpdate updateQuery) - Specified by:
createQuery
in interfacejakarta.persistence.EntityManager
-
createQuery
public jakarta.persistence.Query createQuery(jakarta.persistence.criteria.CriteriaDelete deleteQuery) - Specified by:
createQuery
in interfacejakarta.persistence.EntityManager
-
createDynamicQuery
Description copied from interface:OpenJPAEntityManager
Create an executable query from a dynamically defined query.- Specified by:
createDynamicQuery
in interfaceOpenJPAEntityManager
-
getProperties
Get the properties used currently by this entity manager. The property keys and their values are harvested from kernel artifacts namely the Broker and FetchPlan by reflection. These property keys and values that denote the bean properties/values of the kernel artifacts are converted to the original keys/values that user used to set the properties.- Specified by:
getProperties
in interfacejakarta.persistence.EntityManager
-
getCriteriaBuilder
Description copied from interface:OpenJPAEntityManager
Gets the QueryBuilder with OpenJPA-extended capabilities.- Specified by:
getCriteriaBuilder
in interfacejakarta.persistence.EntityManager
- Specified by:
getCriteriaBuilder
in interfaceOpenJPAEntityManager
-
getSupportedProperties
Description copied from interface:OpenJPAEntityManager
Get the properties supported by this runtime.- Specified by:
getSupportedProperties
in interfaceOpenJPAEntityManager
-
unwrap
Unwraps this receiver to an instance of the given class, if possible.- Specified by:
unwrap
in interfacejakarta.persistence.EntityManager
-
setQuerySQLCache
public void setQuerySQLCache(boolean flag) Description copied from interface:OpenJPAEntityManagerSPI
Sets whether this receiver will cache database queries during its lifetime. The cache configured at BrokerFactory level is not affected by setting it inactive for this receiver.- Specified by:
setQuerySQLCache
in interfaceOpenJPAEntityManagerSPI
-
getQuerySQLCache
public boolean getQuerySQLCache()Description copied from interface:OpenJPAEntityManagerSPI
Affirms if this receiver is caching database queries.- Specified by:
getQuerySQLCache
in interfaceOpenJPAEntityManagerSPI
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()- Specified by:
getMetamodel
in interfacejakarta.persistence.EntityManager
-
createEntityGraph
- Specified by:
createEntityGraph
in interfacejakarta.persistence.EntityManager
-
createEntityGraph
- Specified by:
createEntityGraph
in interfacejakarta.persistence.EntityManager
-
getEntityGraph
- Specified by:
getEntityGraph
in interfacejakarta.persistence.EntityManager
-
getEntityGraphs
- Specified by:
getEntityGraphs
in interfacejakarta.persistence.EntityManager
-
setProperty
Sets the given property to the given value, reflectively. The property key is transposed to a bean-style property. The value is converted to a type consumable by the kernel. After requisite transformation, if the value can not be set on either this instance or its fetch plan by reflection, then an warning message (not an exception as per JPA specification) is issued.- Specified by:
setProperty
in interfacejakarta.persistence.EntityManager
-
clear()
instead.