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
FieldsFields 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_TRANSACTIONALFields 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
ConstructorsConstructorDescriptionEntityManagerImpl(EntityManagerFactoryImpl factory, Broker broker) Constructor; supply factory and delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(Object listener, Class... classes) Register a listener for lifecycle-related events on the specified classes.voidaddTransactionListener(Object listener) Register a listener for transaction-related events.protected voidThrow appropriate exception if close has been invoked but the broker is still open.voidbegin()voidBegins a store transaction if one isn't already started.booleanCancel all pending data store statements.voidclear()voidclose()voidcommit()voidIssue a commit and then start a new transaction.booleanbooleancontainsAll(Object... entities) Whether the given objects are managed.booleancontainsAll(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> TcreateInstance(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.StoredProcedureQuerycreateNativeQuery(String query) createNativeQuery(String query, Class cls) createNativeQuery(String query, String mappingName) jakarta.persistence.QuerycreateQuery(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.QuerycreateQuery(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.StoredProcedureQuerycreateStoredProcedureQuery(String procedureName) jakarta.persistence.StoredProcedureQuerycreateStoredProcedureQuery(String procedureName, Class... resultClasses) jakarta.persistence.StoredProcedureQuerycreateStoredProcedureQuery(String procedureName, String... resultSetMappings) voidObject[]Detach the specified objects from the entity manager.detachAll(Collection entities) Detach the specified objects from the entity manager.<T> TdetachCopy(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.voidMake the named field of the given object dirty.voiddirtyClass(Class cls) Mark the given class as dirty within the current transaction.booleanvoidEvict the given object.voidevictAll()Evict all clean objects.voidEvict all persistent-clean and persistent-nontransactional instances in the extent of the given class (including subclasses).voidEvict the given objects.voidevictAll(Collection entities) Evict the given objects.voidEvict all persistent-clean and persistent-nontransactional instances in the givenExtent.<T> T<T> T<T> Tfind(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> TfindCached(Class<T> cls, Object oid) Return the cached instance for the given oid/object, or null if not cached.voidflush()Whether to clear state when entering a transaction.AutoDetachTypevalues 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.booleanWhether 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 aGeneratorfor the generated values of the specified type, or null if the field is not generated.jakarta.persistence.FlushModeTypegetIdGenerator(Class forClass) Returns aGeneratorfor the datastore identity values of the specified type, or null if the type is unmanaged or its identity cannot be represented by a sequence.booleanWhether to take into account changes in the transaction when executing a query or iterating an extent.intTheCallbackModeflags for handling lifecycle listener exceptions.jakarta.persistence.LockModeTypegetLockMode(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.MetamodelbooleanWhether the entity manager or its managed instances are used in a multithreaded environment.getNamedGenerator(String name) Return the named generator defined in the metadata.booleanWhether to allow nontransactional access to persistent state.booleanWhether 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.booleanWhether to use optimistic transactional semantics.booleanWhether 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.booleanWhether objects accessed during this transaction will be added to the store cache.Get the properties used currently by this entity manager.booleanAffirms if this receiver is caching database queries.<T> TgetReference(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.booleanWhether objects retain their persistent state on transaction commit.Returns the Throwable that caused the transaction to be marked for rollback.booleanGet the properties supported by this runtime.booleanWhether to check for a global transaction upon every managed, non-transactional operation.Return a set of current transaction instances.intTheCallbackModeflags 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.inthashCode()booleanisActive()booleanisDetached(Object entity) Returnstrueifpcis a detached object (one that can be reattached to aEntityManagervia a call toEntityManager.merge(T)); otherwise returnsfalse.booleanReturn whether the given object is dirty.booleanbooleanbooleanbooleanReturn whether the given object was made persistent in the current transaction.booleanisOpen()booleanReturn whether the given object is persistent.booleanReturn whether the given object is deleted.booleanWhether a store transaction is active.booleanWhether 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.booleanReturn whether the given object is transactional.booleanWhether this entity manager is using managed transactions.voidvoidEnsure that the given instance is locked at the current lock level, as set in theFetchPlanfor the entity manager.voidvoidEnsure that the given instance is locked at the given lock level.voidvoidEnsure that the given instances are locked at the current lock level, as set in theFetchPlanfor the entity manager.voidEnsure that the given instances are locked at the given lock level.voidlockAll(Collection entities) Ensure that the given instances are locked at the current lock level, as set in theFetchPlanfor the entity manager.voidlockAll(Collection entities, jakarta.persistence.LockModeType mode, int timeout) Ensure that the given instances are locked at the given lock level.<T> Tmerge(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) voidnontransactional(Object entity) Make the given object nontransactional.voidnontransactionalAll(Object[] objs) Make the given objects nontransactional.voidMake the given objects nontransactional.voidvoidpersistAll(Object... entities) Persist the given objects.voidpersistAll(Collection entities) Persist the given objects.voidPops the fetch plan from the top of the stack, making the next one down the active one.voidpreFlush()Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks.voidDeprecated.intprocessArgument(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.voidvoidvoidvoidvoidvoidRefresh all transactional objects.voidrefreshAll(Object... entities) Refresh the state of the given objects.voidrefreshAll(Collection entities) Refresh the state of the given objects.voidRelease the given object from management.voidreleaseAll(Object... entities) Release the given object from management.voidreleaseAll(Collection entities) Release the given objects from management.voidRelease the last set savepoint and any resources associated with it.voidreleaseSavepoint(String name) Release the savepoint and any resources associated with it.voidvoidDelete the given persistent objects.voidremoveAll(Collection entities) Delete the given persistent objects.voidremoveLifecycleListener(Object listener) Remove a listener for lifecycle-related events.voidremoveTransactionListener(Object listener) Remove a listener for transaction-related events.voidImmediately load the given object's persistent fields.voidretrieveAll(Object... entities) Retrieve the persistent state of the given objects.voidretrieveAll(Collection entities) Retrieve the persistent state of the given objects.voidrollback()voidIssue a rollback and then start a new transaction.voidRollback the current transaction to the last savepoint.voidrollbackToSavepoint(String name) Rollback the current transaction to the given savepoint name.voidsetAutoClear(int autoClear) voidWhether to clear state when entering a transaction.voidsetAutoDetach(int autoDetachFlags) voidsetAutoDetach(int flag, boolean on) voidsetAutoDetach(EnumSet<AutoDetachType> flags) AutoDetachTypevalues which indicate when persistent managed objects should be automatically detached in-place.voidsetAutoDetach(AutoDetachType flag) AutoDetachTypevalues which indicate when persistent managed objects should be automatically detached in-place.voidsetAutoDetach(AutoDetachType value, boolean on) Bit flags marked inAutoDetachTypewhich indicate when persistent managed objects should be automatically detached in-place.voidsetDetachState(int detach) voidDetach mode constant to determine which fields are part of the detached graph.voidsetEvictFromStoreCache(boolean evict) Whether to also evict an object from the store cache when it is evicted through this entity manager.voidsetFlushMode(jakarta.persistence.FlushModeType flushMode) voidsetIgnoreChanges(boolean val) Whether to take into account changes in the transaction when executing a query or iterating an extent.voidsetLargeTransaction(boolean value) voidsetLifecycleListenerCallbackMode(int callbackMode) voidTheCallbackModeflags for handling lifecycle listener exceptions.voidTheCallbackModeflag for handling lifecycle listener exceptions.voidsetMultithreaded(boolean multithreaded) Whether the entity manager or its managed instances are used in a multithreaded environment.voidsetNontransactionalRead(boolean val) Whether to allow nontransactional access to persistent state.voidsetNontransactionalWrite(boolean val) Whether to allow nontransactional changes to persistent state.voidsetOptimistic(boolean val) Whether to use optimistic transactional semantics.voidsetOrderDirtyObjects(boolean order) Whether dirty objects will be returned in the order they were dirtied.voidsetPopulateStoreCache(boolean cache) Whether to populate the store cache with objects used by this transaction.voidsetProperties(Map<String, Object> emEmptyPropsProperties) voidsetProperty(String prop, Object value) Sets the given property to the given value, reflectively.voidsetQuerySQLCache(boolean flag) Sets whether this receiver will cache database queries during its lifetime.voidsetRestoreState(int restore) voidWhether to restore an object's original state on rollback.voidsetRetainState(boolean val) Whether objects retain their persistent state on transaction commit.voidvoidsetRollbackOnly(Throwable cause) Mark the current transaction for rollback with the specified cause of the rollback.voidsetSavepoint(String name) Set a transactional savepoint where operations after this savepoint will be rolled back.voidsetSyncWithManagedTransactions(boolean sync) Whether to check for a global transaction upon every managed, non-transactional operation.voidsetTrackChangesByType(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.voidsetTransactionListenerCallbackMode(int callbackMode) voidTheCallbackModeflags for handling transaction listener exceptions.voidTheCallbackModeflag for handling transaction listener exceptions.voidtransactional(Object entity, boolean updateVersion) Make the given object transactional.voidtransactionalAll(Object[] objs, boolean updateVersion) Make the given objects transactional.voidtransactionalAll(Collection objs, boolean updateVersion) Make the given objects transactional.<T> TUnwraps this receiver to an instance of the given class, if possible.voidValidate the changes made in this transaction, reporting any optimistic violations, constraint violations, etc.protected voidvalidateSQL(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:OpenJPAEntityManagerReturn the factory that produced this entity manager.- Specified by:
getEntityManagerFactoryin interfacejakarta.persistence.EntityManager- Specified by:
getEntityManagerFactoryin interfaceOpenJPAEntityManager
-
getConfiguration
Description copied from interface:OpenJPAEntityManagerSPIReturn the configuration associated with this entity manager.- Specified by:
getConfigurationin interfaceOpenJPAEntityManager- Specified by:
getConfigurationin interfaceOpenJPAEntityManagerSPI
-
getFetchPlan
Description copied from interface:OpenJPAEntityManagerReturn the (mutable) fetch plan for loading objects from this entity manager.- Specified by:
getFetchPlanin interfaceOpenJPAEntityManager
-
pushFetchPlan
Description copied from interface:OpenJPAEntityManagerPushes a new fetch plan that inherits from the current fetch plan onto a stack, and makes the new plan the active one.- Specified by:
pushFetchPlanin interfaceOpenJPAEntityManager- Returns:
- the new fetch plan
-
pushFetchPlan
-
popFetchPlan
public void popFetchPlan()Description copied from interface:OpenJPAEntityManagerPops 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:
popFetchPlanin interfaceOpenJPAEntityManager
-
getConnectionRetainMode
Description copied from interface:OpenJPAEntityManagerReturn the connection retain mode for this entity manager.- Specified by:
getConnectionRetainModein interfaceOpenJPAEntityManager
-
isTransactionManaged
public boolean isTransactionManaged()Description copied from interface:OpenJPAEntityManagerWhether this entity manager is using managed transactions.- Specified by:
isTransactionManagedin interfaceOpenJPAEntityManager
-
isManaged
public boolean isManaged()- Specified by:
isManagedin interfaceOpenJPAEntityManager
-
getManagedRuntime
Description copied from interface:OpenJPAEntityManagerSPIReturn the managed runtime in use.- Specified by:
getManagedRuntimein interfaceOpenJPAEntityManagerSPI
-
getSyncWithManagedTransactions
public boolean getSyncWithManagedTransactions()Description copied from interface:OpenJPAEntityManagerWhether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.- Specified by:
getSyncWithManagedTransactionsin interfaceOpenJPAEntityManager
-
setSyncWithManagedTransactions
public void setSyncWithManagedTransactions(boolean sync) Description copied from interface:OpenJPAEntityManagerWhether to check for a global transaction upon every managed, non-transactional operation. Defaults to false.- Specified by:
setSyncWithManagedTransactionsin interfaceOpenJPAEntityManager
-
getClassLoader
Description copied from interface:OpenJPAEntityManagerReturn the current thread's class loader at the time this entity manager was obtained from the factory.- Specified by:
getClassLoaderin interfaceOpenJPAEntityManager
-
getConnectionUserName
Description copied from interface:OpenJPAEntityManagerReturn the connection user name.- Specified by:
getConnectionUserNamein interfaceOpenJPAEntityManager
-
getConnectionPassword
Description copied from interface:OpenJPAEntityManagerReturn the connection password.- Specified by:
getConnectionPasswordin interfaceOpenJPAEntityManager
-
getMultithreaded
public boolean getMultithreaded()Description copied from interface:OpenJPAEntityManagerWhether the entity manager or its managed instances are used in a multithreaded environment.- Specified by:
getMultithreadedin interfaceOpenJPAEntityManager
-
setMultithreaded
public void setMultithreaded(boolean multithreaded) Description copied from interface:OpenJPAEntityManagerWhether the entity manager or its managed instances are used in a multithreaded environment.- Specified by:
setMultithreadedin interfaceOpenJPAEntityManager
-
getIgnoreChanges
public boolean getIgnoreChanges()Description copied from interface:OpenJPAEntityManagerWhether to take into account changes in the transaction when executing a query or iterating an extent.- Specified by:
getIgnoreChangesin interfaceOpenJPAEntityManager
-
setIgnoreChanges
public void setIgnoreChanges(boolean val) Description copied from interface:OpenJPAEntityManagerWhether to take into account changes in the transaction when executing a query or iterating an extent.- Specified by:
setIgnoreChangesin interfaceOpenJPAEntityManager
-
getNontransactionalRead
public boolean getNontransactionalRead()Description copied from interface:OpenJPAEntityManagerWhether to allow nontransactional access to persistent state.- Specified by:
getNontransactionalReadin interfaceOpenJPAEntityManager
-
setNontransactionalRead
public void setNontransactionalRead(boolean val) Description copied from interface:OpenJPAEntityManagerWhether to allow nontransactional access to persistent state.- Specified by:
setNontransactionalReadin interfaceOpenJPAEntityManager
-
getNontransactionalWrite
public boolean getNontransactionalWrite()Description copied from interface:OpenJPAEntityManagerWhether to allow nontransactional changes to persistent state.- Specified by:
getNontransactionalWritein interfaceOpenJPAEntityManager
-
setNontransactionalWrite
public void setNontransactionalWrite(boolean val) Description copied from interface:OpenJPAEntityManagerWhether to allow nontransactional changes to persistent state.- Specified by:
setNontransactionalWritein interfaceOpenJPAEntityManager
-
getOptimistic
public boolean getOptimistic()Description copied from interface:OpenJPAEntityManagerWhether to use optimistic transactional semantics.- Specified by:
getOptimisticin interfaceOpenJPAEntityManager
-
setOptimistic
public void setOptimistic(boolean val) Description copied from interface:OpenJPAEntityManagerWhether to use optimistic transactional semantics.- Specified by:
setOptimisticin interfaceOpenJPAEntityManager
-
getRestoreState
Description copied from interface:OpenJPAEntityManagerWhether to restore an object's original state on rollback.- Specified by:
getRestoreStatein interfaceOpenJPAEntityManager
-
setRestoreState
Description copied from interface:OpenJPAEntityManagerWhether to restore an object's original state on rollback.- Specified by:
setRestoreStatein interfaceOpenJPAEntityManager
-
setRestoreState
public void setRestoreState(int restore) - Specified by:
setRestoreStatein interfaceOpenJPAEntityManager
-
getRetainState
public boolean getRetainState()Description copied from interface:OpenJPAEntityManagerWhether objects retain their persistent state on transaction commit.- Specified by:
getRetainStatein interfaceOpenJPAEntityManager
-
setRetainState
public void setRetainState(boolean val) Description copied from interface:OpenJPAEntityManagerWhether objects retain their persistent state on transaction commit.- Specified by:
setRetainStatein interfaceOpenJPAEntityManager
-
getAutoClear
Description copied from interface:OpenJPAEntityManagerWhether to clear state when entering a transaction.- Specified by:
getAutoClearin interfaceOpenJPAEntityManager
-
setAutoClear
Description copied from interface:OpenJPAEntityManagerWhether to clear state when entering a transaction.- Specified by:
setAutoClearin interfaceOpenJPAEntityManager
-
setAutoClear
public void setAutoClear(int autoClear) - Specified by:
setAutoClearin interfaceOpenJPAEntityManager
-
getDetachState
Description copied from interface:OpenJPAEntityManagerDetach mode constant to determine which fields are part of the detached graph.- Specified by:
getDetachStatein interfaceOpenJPAEntityManager
-
setDetachState
Description copied from interface:OpenJPAEntityManagerDetach mode constant to determine which fields are part of the detached graph.- Specified by:
setDetachStatein interfaceOpenJPAEntityManager
-
setDetachState
public void setDetachState(int detach) - Specified by:
setDetachStatein interfaceOpenJPAEntityManager
-
getAutoDetach
Description copied from interface:OpenJPAEntityManagerAutoDetachTypevalues which indicate when persistent managed objects should be automatically detached in-place.- Specified by:
getAutoDetachin interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManagerAutoDetachTypevalues which indicate when persistent managed objects should be automatically detached in-place. The current value is replaced in its entirety.- Specified by:
setAutoDetachin interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManagerAutoDetachTypevalues which indicate when persistent managed objects should be automatically detached in-place. The current value is replaced in its entirety.- Specified by:
setAutoDetachin interfaceOpenJPAEntityManager
-
setAutoDetach
public void setAutoDetach(int autoDetachFlags) - Specified by:
setAutoDetachin interfaceOpenJPAEntityManager
-
setAutoDetach
Description copied from interface:OpenJPAEntityManagerBit flags marked inAutoDetachTypewhich indicate when persistent managed objects should be automatically detached in-place.- Specified by:
setAutoDetachin interfaceOpenJPAEntityManager
-
setAutoDetach
public void setAutoDetach(int flag, boolean on) - Specified by:
setAutoDetachin interfaceOpenJPAEntityManager
-
getEvictFromStoreCache
public boolean getEvictFromStoreCache()Description copied from interface:OpenJPAEntityManagerWhether to also evict an object from the store cache when it is evicted through this entity manager.- Specified by:
getEvictFromStoreCachein interfaceOpenJPAEntityManager
-
setEvictFromStoreCache
public void setEvictFromStoreCache(boolean evict) Description copied from interface:OpenJPAEntityManagerWhether to also evict an object from the store cache when it is evicted through this entity manager.- Specified by:
setEvictFromStoreCachein interfaceOpenJPAEntityManager
-
getPopulateStoreCache
public boolean getPopulateStoreCache()Description copied from interface:OpenJPAEntityManagerWhether objects accessed during this transaction will be added to the store cache. Defaults to true.- Specified by:
getPopulateStoreCachein interfaceOpenJPAEntityManager
-
setPopulateStoreCache
public void setPopulateStoreCache(boolean cache) Description copied from interface:OpenJPAEntityManagerWhether to populate the store cache with objects used by this transaction. Defaults to true.- Specified by:
setPopulateStoreCachein interfaceOpenJPAEntityManager
-
isTrackChangesByType
public boolean isTrackChangesByType()Description copied from interface:OpenJPAEntityManagerWhether 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:
isTrackChangesByTypein interfaceOpenJPAEntityManager
-
setTrackChangesByType
public void setTrackChangesByType(boolean trackByType) Description copied from interface:OpenJPAEntityManagerIf 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:
setTrackChangesByTypein interfaceOpenJPAEntityManager
-
isLargeTransaction
public boolean isLargeTransaction()- Specified by:
isLargeTransactionin interfaceOpenJPAEntityManager
-
setLargeTransaction
public void setLargeTransaction(boolean value) - Specified by:
setLargeTransactionin interfaceOpenJPAEntityManager
-
getUserObject
Description copied from interface:OpenJPAEntityManagerGet the value for the specified key from the map of user objects.- Specified by:
getUserObjectin interfaceOpenJPAEntityManager
-
putUserObject
Description copied from interface:OpenJPAEntityManagerPut the specified key-value pair into the map of user objects. Use a value of null to remove the key.- Specified by:
putUserObjectin interfaceOpenJPAEntityManager
-
addTransactionListener
Description copied from interface:OpenJPAEntityManagerSPIRegister a listener for transaction-related events.- Specified by:
addTransactionListenerin interfaceOpenJPAEntityManager- Specified by:
addTransactionListenerin interfaceOpenJPAEntityManagerSPI
-
removeTransactionListener
Description copied from interface:OpenJPAEntityManagerSPIRemove a listener for transaction-related events.- Specified by:
removeTransactionListenerin interfaceOpenJPAEntityManager- Specified by:
removeTransactionListenerin interfaceOpenJPAEntityManagerSPI
-
getTransactionListenerCallbackModes
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflags for handling transaction listener exceptions.- Specified by:
getTransactionListenerCallbackModesin interfaceOpenJPAEntityManagerSPI
-
setTransactionListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflag for handling transaction listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setTransactionListenerCallbackModein interfaceOpenJPAEntityManagerSPI
-
setTransactionListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflags for handling transaction listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setTransactionListenerCallbackModein interfaceOpenJPAEntityManagerSPI
-
getTransactionListenerCallbackMode
public int getTransactionListenerCallbackMode()- Specified by:
getTransactionListenerCallbackModein interfaceOpenJPAEntityManager
-
setTransactionListenerCallbackMode
public void setTransactionListenerCallbackMode(int callbackMode) - Specified by:
setTransactionListenerCallbackModein interfaceOpenJPAEntityManager
-
addLifecycleListener
Description copied from interface:OpenJPAEntityManagerSPIRegister 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:
addLifecycleListenerin interfaceOpenJPAEntityManager- Specified by:
addLifecycleListenerin interfaceOpenJPAEntityManagerSPI
-
removeLifecycleListener
Description copied from interface:OpenJPAEntityManagerSPIRemove a listener for lifecycle-related events.- Specified by:
removeLifecycleListenerin interfaceOpenJPAEntityManager- Specified by:
removeLifecycleListenerin interfaceOpenJPAEntityManagerSPI
-
getLifecycleListenerCallbackModes
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflags for handling lifecycle listener exceptions.- Specified by:
getLifecycleListenerCallbackModesin interfaceOpenJPAEntityManagerSPI
-
setLifecycleListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflag for handling lifecycle listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setLifecycleListenerCallbackModein interfaceOpenJPAEntityManagerSPI
-
setLifecycleListenerCallbackMode
Description copied from interface:OpenJPAEntityManagerSPITheCallbackModeflags for handling lifecycle listener exceptions. The flags provided here will entirely replace the previous settings.- Specified by:
setLifecycleListenerCallbackModein interfaceOpenJPAEntityManagerSPI
-
getLifecycleListenerCallbackMode
public int getLifecycleListenerCallbackMode()- Specified by:
getLifecycleListenerCallbackModein interfaceOpenJPAEntityManager
-
setLifecycleListenerCallbackMode
public void setLifecycleListenerCallbackMode(int callbackMode) - Specified by:
setLifecycleListenerCallbackModein interfaceOpenJPAEntityManager
-
getReference
- Specified by:
getReferencein interfacejakarta.persistence.EntityManager
-
find
- Specified by:
findin interfacejakarta.persistence.EntityManager
-
find
- Specified by:
findin interfacejakarta.persistence.EntityManager
-
find
- Specified by:
findin interfacejakarta.persistence.EntityManager
-
find
public <T> T find(Class<T> cls, Object oid, jakarta.persistence.LockModeType mode, Map<String, Object> properties) - Specified by:
findin interfacejakarta.persistence.EntityManager
-
findAll
Description copied from interface:OpenJPAEntityManagerReturn the objects with the given oids.- Specified by:
findAllin interfaceOpenJPAEntityManageroids- 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:OpenJPAEntityManagerReturn the objects with the given oids.- Specified by:
findAllin interfaceOpenJPAEntityManageroids- 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:OpenJPAEntityManagerReturn the cached instance for the given oid/object, or null if not cached.- Specified by:
findCachedin interfaceOpenJPAEntityManageroid- the object's id- Returns:
- the cached object, or null if not cached
-
getObjectIdClass
Description copied from interface:OpenJPAEntityManagerReturn the application identity class the given persistent class uses for object ids, or null if not a type that uses application identity.- Specified by:
getObjectIdClassin interfaceOpenJPAEntityManager
-
getTransaction
- Specified by:
getTransactionin interfacejakarta.persistence.EntityManager- Specified by:
getTransactionin interfaceOpenJPAEntityManager
-
joinTransaction
public void joinTransaction()- Specified by:
joinTransactionin interfacejakarta.persistence.EntityManager
-
isJoinedToTransaction
public boolean isJoinedToTransaction()- Specified by:
isJoinedToTransactionin interfacejakarta.persistence.EntityManager
-
begin
public void begin()- Specified by:
beginin interfacejakarta.persistence.EntityTransaction- Specified by:
beginin interfaceOpenJPAEntityManager
-
commit
public void commit()- Specified by:
commitin interfacejakarta.persistence.EntityTransaction- Specified by:
commitin interfaceOpenJPAEntityManager
-
rollback
public void rollback()- Specified by:
rollbackin interfacejakarta.persistence.EntityTransaction- Specified by:
rollbackin interfaceOpenJPAEntityManager
-
commitAndResume
public void commitAndResume()Description copied from interface:OpenJPAEntityTransactionIssue 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:
commitAndResumein interfaceOpenJPAEntityManager- Specified by:
commitAndResumein interfaceOpenJPAEntityTransaction- See Also:
-
EntityTransaction.commit()EntityTransaction.begin()
-
rollbackAndResume
public void rollbackAndResume()Description copied from interface:OpenJPAEntityTransactionIssue 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:
rollbackAndResumein interfaceOpenJPAEntityManager- Specified by:
rollbackAndResumein interfaceOpenJPAEntityTransaction- See Also:
-
EntityTransaction.rollback()EntityTransaction.begin()
-
getRollbackCause
Description copied from interface:OpenJPAEntityTransactionReturns the Throwable that caused the transaction to be marked for rollback.- Specified by:
getRollbackCausein interfaceOpenJPAEntityManager- Specified by:
getRollbackCausein interfaceOpenJPAEntityTransaction- Returns:
- the Throwable, or null if none was given
-
getRollbackOnly
public boolean getRollbackOnly()- Specified by:
getRollbackOnlyin interfacejakarta.persistence.EntityTransaction- Specified by:
getRollbackOnlyin interfaceOpenJPAEntityManager
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnlyin interfacejakarta.persistence.EntityTransaction- Specified by:
setRollbackOnlyin interfaceOpenJPAEntityManager
-
setRollbackOnly
Description copied from interface:OpenJPAEntityTransactionMark the current transaction for rollback with the specified cause of the rollback.- Specified by:
setRollbackOnlyin interfaceOpenJPAEntityManager- Specified by:
setRollbackOnlyin interfaceOpenJPAEntityTransaction
-
setSavepoint
Description copied from interface:OpenJPAEntityManagerSet a transactional savepoint where operations after this savepoint will be rolled back.- Specified by:
setSavepointin interfaceOpenJPAEntityManager
-
rollbackToSavepoint
public void rollbackToSavepoint()Description copied from interface:OpenJPAEntityManagerRollback the current transaction to the last savepoint. Savepoints set after this one will become invalid.- Specified by:
rollbackToSavepointin interfaceOpenJPAEntityManager
-
rollbackToSavepoint
Description copied from interface:OpenJPAEntityManagerRollback the current transaction to the given savepoint name. Savepoints set after this one will become invalid.- Specified by:
rollbackToSavepointin interfaceOpenJPAEntityManager
-
releaseSavepoint
public void releaseSavepoint()Description copied from interface:OpenJPAEntityManagerRelease the last set savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.- Specified by:
releaseSavepointin interfaceOpenJPAEntityManager
-
releaseSavepoint
Description copied from interface:OpenJPAEntityManagerRelease the savepoint and any resources associated with it. The given savepoint and any set after it will become invalid.- Specified by:
releaseSavepointin interfaceOpenJPAEntityManager
-
flush
public void flush()- Specified by:
flushin interfacejakarta.persistence.EntityManager
-
preFlush
public void preFlush()Description copied from interface:OpenJPAEntityManagerRun 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:
preFlushin interfaceOpenJPAEntityManager
-
validateChanges
public void validateChanges()Description copied from interface:OpenJPAEntityManagerValidate 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:
validateChangesin interfaceOpenJPAEntityManager
-
isActive
public boolean isActive()- Specified by:
isActivein interfacejakarta.persistence.EntityTransaction- Specified by:
isActivein interfaceOpenJPAEntityManager
-
isStoreActive
public boolean isStoreActive()Description copied from interface:OpenJPAEntityManagerWhether a store transaction is active.- Specified by:
isStoreActivein interfaceOpenJPAEntityManager
-
beginStore
public void beginStore()Description copied from interface:OpenJPAEntityManagerBegins a store transaction if one isn't already started. The entity manager must already be in a logical transaction.- Specified by:
beginStorein interfaceOpenJPAEntityManager
-
contains
- Specified by:
containsin interfacejakarta.persistence.EntityManager
-
containsAll
Description copied from interface:OpenJPAEntityManagerWhether the given objects are managed.- Specified by:
containsAllin interfaceOpenJPAEntityManager
-
containsAll
Description copied from interface:OpenJPAEntityManagerWhether the given objects are managed.- Specified by:
containsAllin interfaceOpenJPAEntityManager
-
persist
- Specified by:
persistin interfacejakarta.persistence.EntityManager
-
persistAll
Description copied from interface:OpenJPAEntityManagerPersist the given objects.- Specified by:
persistAllin interfaceOpenJPAEntityManager
-
persistAll
Description copied from interface:OpenJPAEntityManagerPersist the given objects.- Specified by:
persistAllin interfaceOpenJPAEntityManager
-
remove
- Specified by:
removein interfacejakarta.persistence.EntityManager
-
removeAll
Description copied from interface:OpenJPAEntityManagerDelete the given persistent objects.- Specified by:
removeAllin interfaceOpenJPAEntityManager
-
removeAll
Description copied from interface:OpenJPAEntityManagerDelete the given persistent objects.- Specified by:
removeAllin interfaceOpenJPAEntityManager
-
release
Description copied from interface:OpenJPAEntityManagerRelease the given object from management. This operation is not recursive.- Specified by:
releasein interfaceOpenJPAEntityManager
-
releaseAll
Description copied from interface:OpenJPAEntityManagerRelease the given objects from management. This operation is not recursive.- Specified by:
releaseAllin interfaceOpenJPAEntityManager
-
releaseAll
Description copied from interface:OpenJPAEntityManagerRelease the given object from management. This operation is not recursive.- Specified by:
releaseAllin interfaceOpenJPAEntityManager
-
refresh
- Specified by:
refreshin interfacejakarta.persistence.EntityManager
-
refresh
- Specified by:
refreshin interfacejakarta.persistence.EntityManager
-
refresh
- Specified by:
refreshin interfacejakarta.persistence.EntityManager
-
refresh
public void refresh(Object entity, jakarta.persistence.LockModeType mode, Map<String, Object> properties) - Specified by:
refreshin interfacejakarta.persistence.EntityManager
-
refreshAll
public void refreshAll()Description copied from interface:OpenJPAEntityManagerRefresh all transactional objects.- Specified by:
refreshAllin interfaceOpenJPAEntityManager
-
refreshAll
Description copied from interface:OpenJPAEntityManagerRefresh the state of the given objects.- Specified by:
refreshAllin interfaceOpenJPAEntityManager
-
refreshAll
Description copied from interface:OpenJPAEntityManagerRefresh the state of the given objects.- Specified by:
refreshAllin interfaceOpenJPAEntityManager
-
retrieve
Description copied from interface:OpenJPAEntityManagerImmediately 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:
retrievein interfaceOpenJPAEntityManager
-
retrieveAll
Description copied from interface:OpenJPAEntityManagerRetrieve the persistent state of the given objects.- Specified by:
retrieveAllin interfaceOpenJPAEntityManager- See Also:
-
retrieveAll
Description copied from interface:OpenJPAEntityManagerRetrieve the persistent state of the given objects.- Specified by:
retrieveAllin interfaceOpenJPAEntityManager- See Also:
-
evict
Description copied from interface:OpenJPAEntityManagerEvict 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:
evictin interfaceOpenJPAEntityManager- Parameters:
entity- A persistent class which will be evicted
-
evictAll
Description copied from interface:OpenJPAEntityManagerEvict 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:
evictAllin interfaceOpenJPAEntityManager- Parameters:
entities- A collection of persistent classes which will be evicted.
-
evictAll
Description copied from interface:OpenJPAEntityManagerEvict 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:
evictAllin interfaceOpenJPAEntityManager- Parameters:
entities- The persistent classes which will be evicted
-
evictAll
public void evictAll()Description copied from interface:OpenJPAEntityManagerEvict 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:
evictAllin interfaceOpenJPAEntityManager
-
evictAll
Description copied from interface:OpenJPAEntityManagerEvict 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:
evictAllin interfaceOpenJPAEntityManager- Parameters:
cls- All clean instances of this class will be evicted.
-
evictAll
Description copied from interface:OpenJPAEntityManagerEvict 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:
evictAllin interfaceOpenJPAEntityManager- Parameters:
extent- Extend which contains the persistent classes to evict.
-
detachCopy
public <T> T detachCopy(T entity) Description copied from interface:OpenJPAEntityManagerDetach the specified object from the entity manager, detaching based on the AutoDetach value specified and returning a copy of the detached entity.- Specified by:
detachCopyin interfaceOpenJPAEntityManager- Parameters:
entity- the instance to detach- Returns:
- the detached instance
-
detachAll
Description copied from interface:OpenJPAEntityManagerDetach the specified objects from the entity manager.- Specified by:
detachAllin interfaceOpenJPAEntityManager- Parameters:
entities- the instances to detach- Returns:
- the detached instances
-
detachAll
Description copied from interface:OpenJPAEntityManagerDetach the specified objects from the entity manager.- Specified by:
detachAllin interfaceOpenJPAEntityManager- Parameters:
entities- the instances to detach- Returns:
- the detached instances
-
merge
public <T> T merge(T entity) - Specified by:
mergein interfacejakarta.persistence.EntityManager
-
mergeAll
Description copied from interface:OpenJPAEntityManagerMerge the specified objects into the entity manager.- Specified by:
mergeAllin interfaceOpenJPAEntityManager- Parameters:
entities- instances to import- Returns:
- the re-attached instances
-
mergeAll
Description copied from interface:OpenJPAEntityManagerMerge the specified detached objects into the entity manager.- Specified by:
mergeAllin interfaceOpenJPAEntityManager- Parameters:
entities- Collection of instances to import- Returns:
- the re-attached instances
-
transactional
Description copied from interface:OpenJPAEntityManagerMake the given object transactional.- Specified by:
transactionalin 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:OpenJPAEntityManagerMake the given objects transactional.- Specified by:
transactionalAllin 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:OpenJPAEntityManagerMake the given objects transactional.- Specified by:
transactionalAllin 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:OpenJPAEntityManagerMake the given object nontransactional.- Specified by:
nontransactionalin interfaceOpenJPAEntityManager
-
nontransactionalAll
Description copied from interface:OpenJPAEntityManagerMake the given objects nontransactional.- Specified by:
nontransactionalAllin interfaceOpenJPAEntityManager
-
nontransactionalAll
Description copied from interface:OpenJPAEntityManagerMake the given objects nontransactional.- Specified by:
nontransactionalAllin interfaceOpenJPAEntityManager
-
getNamedGenerator
Description copied from interface:OpenJPAEntityManagerReturn the named generator defined in the metadata.- Specified by:
getNamedGeneratorin interfaceOpenJPAEntityManager
-
getIdGenerator
Description copied from interface:OpenJPAEntityManagerReturns aGeneratorfor 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:
getIdGeneratorin interfaceOpenJPAEntityManager
-
getFieldGenerator
Description copied from interface:OpenJPAEntityManagerReturns aGeneratorfor the generated values of the specified type, or null if the field is not generated.- Specified by:
getFieldGeneratorin interfaceOpenJPAEntityManager
-
createExtent
Description copied from interface:OpenJPAEntityManagerReturn an extent of the given class, optionally including subclasses.- Specified by:
createExtentin interfaceOpenJPAEntityManager
-
createQuery
- Specified by:
createQueryin interfacejakarta.persistence.EntityManager
-
createQuery
- Specified by:
createQueryin interfacejakarta.persistence.EntityManager- Specified by:
createQueryin interfaceOpenJPAEntityManager
-
createQuery
Description copied from interface:OpenJPAEntityManagerCreate a new query in the given language.- Specified by:
createQueryin interfaceOpenJPAEntityManager
-
createQuery
Description copied from interface:OpenJPAEntityManagerCreate a new query from the given one.- Specified by:
createQueryin interfaceOpenJPAEntityManager
-
createNamedQuery
- Specified by:
createNamedQueryin interfacejakarta.persistence.EntityManager
-
createNamedQuery
- Specified by:
createNamedQueryin interfacejakarta.persistence.EntityManager- Specified by:
createNamedQueryin interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQueryin interfacejakarta.persistence.EntityManager- Specified by:
createNativeQueryin interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQueryin interfacejakarta.persistence.EntityManager- Specified by:
createNativeQueryin interfaceOpenJPAEntityManager
-
createNativeQuery
- Specified by:
createNativeQueryin interfacejakarta.persistence.EntityManager- Specified by:
createNativeQueryin interfaceOpenJPAEntityManager
-
createNamedStoredProcedureQuery
- Specified by:
createNamedStoredProcedureQueryin interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
- Specified by:
createStoredProcedureQueryin interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
public jakarta.persistence.StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) - Specified by:
createStoredProcedureQueryin interfacejakarta.persistence.EntityManager
-
createStoredProcedureQuery
public jakarta.persistence.StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings) - Specified by:
createStoredProcedureQueryin interfacejakarta.persistence.EntityManager
-
newQueryImpl
-
newQueryImpl
-
validateSQL
Validate that the user provided SQL. -
setFlushMode
public void setFlushMode(jakarta.persistence.FlushModeType flushMode) - Specified by:
setFlushModein interfacejakarta.persistence.EntityManager
-
getFlushMode
public jakarta.persistence.FlushModeType getFlushMode()- Specified by:
getFlushModein 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:
clearin interfacejakarta.persistence.EntityManager
-
getDelegate
- Specified by:
getDelegatein interfacejakarta.persistence.EntityManager
-
getLockMode
Description copied from interface:OpenJPAEntityManagerReturn the lock mode of the given instance, or null if not locked.- Specified by:
getLockModein interfacejakarta.persistence.EntityManager- Specified by:
getLockModein interfaceOpenJPAEntityManager
-
lock
- Specified by:
lockin interfacejakarta.persistence.EntityManager
-
lock
Description copied from interface:OpenJPAEntityManagerEnsure that the given instance is locked at the current lock level, as set in theFetchPlanfor the entity manager.- Specified by:
lockin interfaceOpenJPAEntityManager
-
lock
Description copied from interface:OpenJPAEntityManagerEnsure that the given instance is locked at the given lock level.- Specified by:
lockin 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:
lockin interfacejakarta.persistence.EntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManagerEnsure that the given instances are locked at the current lock level, as set in theFetchPlanfor the entity manager.- Specified by:
lockAllin interfaceOpenJPAEntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManagerEnsure that the given instances are locked at the given lock level.- Specified by:
lockAllin 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:OpenJPAEntityManagerEnsure that the given instances are locked at the current lock level, as set in theFetchPlanfor the entity manager.- Specified by:
lockAllin interfaceOpenJPAEntityManager
-
lockAll
Description copied from interface:OpenJPAEntityManagerEnsure that the given instances are locked at the given lock level.- Specified by:
lockAllin 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:OpenJPAEntityManagerCancel 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:
cancelAllin interfaceOpenJPAEntityManager- Returns:
- true if any statements were cancelled, false otherwise
-
getConnection
Description copied from interface:OpenJPAEntityManagerReturn the connection in use by the entity manager, or a new connection if none.- Specified by:
getConnectionin interfaceOpenJPAEntityManager
-
getManagedObjects
Description copied from interface:OpenJPAEntityManagerReturn a set of all managed instances.- Specified by:
getManagedObjectsin interfaceOpenJPAEntityManager
-
getTransactionalObjects
Description copied from interface:OpenJPAEntityManagerReturn a set of current transaction instances.- Specified by:
getTransactionalObjectsin interfaceOpenJPAEntityManager
-
getPendingTransactionalObjects
Description copied from interface:OpenJPAEntityManagerReturn a set of instances which will become transactional upon the next transaction.- Specified by:
getPendingTransactionalObjectsin interfaceOpenJPAEntityManager
-
getDirtyObjects
Description copied from interface:OpenJPAEntityManagerReturn a set of current dirty instances.- Specified by:
getDirtyObjectsin interfaceOpenJPAEntityManager
-
getOrderDirtyObjects
public boolean getOrderDirtyObjects()Description copied from interface:OpenJPAEntityManagerWhether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.- Specified by:
getOrderDirtyObjectsin interfaceOpenJPAEntityManager
-
setOrderDirtyObjects
public void setOrderDirtyObjects(boolean order) Description copied from interface:OpenJPAEntityManagerWhether dirty objects will be returned in the order they were dirtied. Default is determined by the store manager.- Specified by:
setOrderDirtyObjectsin interfaceOpenJPAEntityManager
-
dirtyClass
Description copied from interface:OpenJPAEntityManagerMark the given class as dirty within the current transaction.- Specified by:
dirtyClassin interfaceOpenJPAEntityManager
-
getPersistedClasses
Description copied from interface:OpenJPAEntityManagerReturn the set of classes that have been made persistent in the current transaction.- Specified by:
getPersistedClassesin interfaceOpenJPAEntityManager
-
getUpdatedClasses
Description copied from interface:OpenJPAEntityManagerReturn the set of classes for objects that have been modified in the current transaction.- Specified by:
getUpdatedClassesin interfaceOpenJPAEntityManager
-
getRemovedClasses
Description copied from interface:OpenJPAEntityManagerReturn the set of classes that have been deleted in the current transaction.- Specified by:
getRemovedClassesin interfaceOpenJPAEntityManager
-
createInstance
Description copied from interface:OpenJPAEntityManagerCreate a new instance of typecls. Ifclsis 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. Ifclsis 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 inclsto enable persistent attribute tracking. Otherwise, ifclsis a managed type, this will return an instance of the specified class.- Specified by:
createInstancein interfaceOpenJPAEntityManager
-
close
public void close() -
isOpen
public boolean isOpen()- Specified by:
isOpenin interfacejakarta.persistence.EntityManager
-
dirty
Description copied from interface:OpenJPAEntityManagerMake the named field of the given object dirty.- Specified by:
dirtyin interfaceOpenJPAEntityManager
-
getObjectId
Description copied from interface:OpenJPAEntityManagerReturn the oid of the given instance.- Specified by:
getObjectIdin interfaceOpenJPAEntityManager
-
isDirty
Description copied from interface:OpenJPAEntityManagerReturn whether the given object is dirty.- Specified by:
isDirtyin interfaceOpenJPAEntityManager
-
isTransactional
Description copied from interface:OpenJPAEntityManagerReturn whether the given object is transactional.- Specified by:
isTransactionalin interfaceOpenJPAEntityManager
-
isPersistent
Description copied from interface:OpenJPAEntityManagerReturn whether the given object is persistent.- Specified by:
isPersistentin interfaceOpenJPAEntityManager
-
isNewlyPersistent
Description copied from interface:OpenJPAEntityManagerReturn whether the given object was made persistent in the current transaction.- Specified by:
isNewlyPersistentin interfaceOpenJPAEntityManager
-
isRemoved
Description copied from interface:OpenJPAEntityManagerReturn whether the given object is deleted.- Specified by:
isRemovedin interfaceOpenJPAEntityManager
-
isDetached
Description copied from interface:OpenJPAEntityManagerReturnstrueifpcis a detached object (one that can be reattached to aEntityManagervia a call toEntityManager.merge(T)); otherwise returnsfalse.- Specified by:
isDetachedin interfaceOpenJPAEntityManager
-
getVersion
Description copied from interface:OpenJPAEntityManagerReturns the current version indicator foro.- Specified by:
getVersionin 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:FindCallbacksProcess find argument. Throw properOpenJPAExceptionfor illegal value.- Specified by:
processArgumentin interfaceFindCallbacks- Returns:
- the id to look up, or null to ignore this argument
-
processReturn
Description copied from interface:FindCallbacksProcess operation return value.- Specified by:
processReturnin interfaceFindCallbacks- Returns:
- the object to return
-
processArgument
Description copied from interface:OpCallbacksProcess operation argument. Throw properOpenJPAExceptionfor illegal value.- Specified by:
processArgumentin 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:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
setProperties
-
detach
- Specified by:
detachin 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:
createQueryin interfacejakarta.persistence.EntityManager
-
createQuery
public jakarta.persistence.Query createQuery(jakarta.persistence.criteria.CriteriaUpdate updateQuery) - Specified by:
createQueryin interfacejakarta.persistence.EntityManager
-
createQuery
public jakarta.persistence.Query createQuery(jakarta.persistence.criteria.CriteriaDelete deleteQuery) - Specified by:
createQueryin interfacejakarta.persistence.EntityManager
-
createDynamicQuery
Description copied from interface:OpenJPAEntityManagerCreate an executable query from a dynamically defined query.- Specified by:
createDynamicQueryin 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:
getPropertiesin interfacejakarta.persistence.EntityManager
-
getCriteriaBuilder
Description copied from interface:OpenJPAEntityManagerGets the QueryBuilder with OpenJPA-extended capabilities.- Specified by:
getCriteriaBuilderin interfacejakarta.persistence.EntityManager- Specified by:
getCriteriaBuilderin interfaceOpenJPAEntityManager
-
getSupportedProperties
Description copied from interface:OpenJPAEntityManagerGet the properties supported by this runtime.- Specified by:
getSupportedPropertiesin interfaceOpenJPAEntityManager
-
unwrap
Unwraps this receiver to an instance of the given class, if possible.- Specified by:
unwrapin interfacejakarta.persistence.EntityManager
-
setQuerySQLCache
public void setQuerySQLCache(boolean flag) Description copied from interface:OpenJPAEntityManagerSPISets 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:
setQuerySQLCachein interfaceOpenJPAEntityManagerSPI
-
getQuerySQLCache
public boolean getQuerySQLCache()Description copied from interface:OpenJPAEntityManagerSPIAffirms if this receiver is caching database queries.- Specified by:
getQuerySQLCachein interfaceOpenJPAEntityManagerSPI
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()- Specified by:
getMetamodelin interfacejakarta.persistence.EntityManager
-
createEntityGraph
- Specified by:
createEntityGraphin interfacejakarta.persistence.EntityManager
-
createEntityGraph
- Specified by:
createEntityGraphin interfacejakarta.persistence.EntityManager
-
getEntityGraph
- Specified by:
getEntityGraphin interfacejakarta.persistence.EntityManager
-
getEntityGraphs
- Specified by:
getEntityGraphsin 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:
setPropertyin interfacejakarta.persistence.EntityManager
-
clear()instead.