Package org.jboss.as.jpa.container
Class TransactionScopedEntityManager
java.lang.Object
org.jboss.as.jpa.container.AbstractEntityManager
org.jboss.as.jpa.container.TransactionScopedEntityManager
- All Implemented Interfaces:
jakarta.persistence.EntityManager,Serializable,AutoCloseable
Transaction scoped entity manager will be injected into SLSB or SFSB beans. At bean invocation time, they
will join the active transaction if one is present. Otherwise, they will simply be cleared at the end of
the bean invocation.
This is a proxy for the underlying persistent provider EntityManager.
- Author:
- Scott Marlow
- See Also:
-
Field Summary
Fields inherited from class org.jboss.as.jpa.container.AbstractEntityManager
NONE_LOCK_MODE, NULL_LOCK_MODE, OPTIMISTIC_FORCE_INCREMENT_LOCK_MODE, OPTIMISTIC_LOCK_MODE, PESSIMISTIC_FORCE_INCREMENT_LOCK_MODE, PESSIMISTIC_READ_LOCK_MODE, PESSIMISTIC_WRITE_LOCK_MODE, READ_LOCK_MODE, WRITE_LOCK_MODE -
Constructor Summary
ConstructorsConstructorDescriptionTransactionScopedEntityManager(String puScopedName, Map properties, jakarta.persistence.EntityManagerFactory emf, jakarta.persistence.SynchronizationType synchronizationType, jakarta.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry, jakarta.transaction.TransactionManager transactionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Catch the application trying to close the container managed entity manager and throw an IllegalStateExceptionprotected booleanreturn true if non-tx invocations should defer detaching of entities until entity manager is closed.protected jakarta.persistence.EntityManagerjakarta.persistence.SynchronizationTypeprotected booleanprotected booleanisInTx()protected booleanreturn true if non-tx invocations should defer detaching of query results until entity manager is closed.Methods inherited from class org.jboss.as.jpa.container.AbstractEntityManager
clear, contains, createEntityGraph, createEntityGraph, createNamedQuery, createNamedQuery, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, detach, detachNonTxInvocation, detachQueryNonTxInvocation, detachTypedQueryNonTxInvocation, find, find, find, find, flush, getCriteriaBuilder, getDelegate, getEntityGraph, getEntityGraphs, getEntityManagerFactory, getFlushMode, getLockMode, getMetamodel, getProperties, getReference, getTransaction, isJoinedToTransaction, isOpen, joinTransaction, lock, lock, merge, persist, refresh, refresh, refresh, refresh, remove, setFlushMode, setProperty, unwrap
-
Constructor Details
-
TransactionScopedEntityManager
public TransactionScopedEntityManager(String puScopedName, Map properties, jakarta.persistence.EntityManagerFactory emf, jakarta.persistence.SynchronizationType synchronizationType, jakarta.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry, jakarta.transaction.TransactionManager transactionManager)
-
-
Method Details
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager()- Specified by:
getEntityManagerin classAbstractEntityManager
-
isExtendedPersistenceContext
protected boolean isExtendedPersistenceContext()- Specified by:
isExtendedPersistenceContextin classAbstractEntityManager- Returns:
- true if an extended persistence context is in use Precondition: getEntityManager() must be called previous to calling isExtendedPersistenceContext
-
isInTx
protected boolean isInTx()- Specified by:
isInTxin classAbstractEntityManager- Returns:
- true if a Jakarta Transactions transaction active Precondition: getEntityManager() must be called previous to calling isInTx
-
close
public void close()Catch the application trying to close the container managed entity manager and throw an IllegalStateException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejakarta.persistence.EntityManager- Overrides:
closein classAbstractEntityManager
-
getSynchronizationType
public jakarta.persistence.SynchronizationType getSynchronizationType()- Specified by:
getSynchronizationTypein classAbstractEntityManager
-
deferEntityDetachUntilClose
protected boolean deferEntityDetachUntilClose()return true if non-tx invocations should defer detaching of entities until entity manager is closed. Note that this is an extension for compatibility with JBoss application server 5.0/6.0 (see AS7-2781)- Specified by:
deferEntityDetachUntilClosein classAbstractEntityManager
-
skipQueryDetach
protected boolean skipQueryDetach()return true if non-tx invocations should defer detaching of query results until entity manager is closed. Note that this is an extension for compatibility with JBoss application server 5.0/6.0 (see WFLY-12674)- Specified by:
skipQueryDetachin classAbstractEntityManager
-