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
public class TransactionScopedEntityManager extends AbstractEntityManager implements Serializable
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:
- Serialized Form
-
-
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
Constructors Constructor Description TransactionScopedEntityManager(String puScopedName, Map properties, jakarta.persistence.EntityManagerFactory emf, jakarta.persistence.SynchronizationType synchronizationType, jakarta.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry, jakarta.transaction.TransactionManager transactionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Catch the application trying to close the container managed entity manager and throw an IllegalStateExceptionprotected booleandeferEntityDetachUntilClose()return true if non-tx invocations should defer detaching of entities until entity manager is closed.protected jakarta.persistence.EntityManagergetEntityManager()jakarta.persistence.SynchronizationTypegetSynchronizationType()protected booleanisExtendedPersistenceContext()protected booleanisInTx()protected booleanskipQueryDetach()return 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 Detail
-
TransactionScopedEntityManager
public TransactionScopedEntityManager(String puScopedName, Map properties, jakarta.persistence.EntityManagerFactory emf, jakarta.persistence.SynchronizationType synchronizationType, jakarta.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry, jakarta.transaction.TransactionManager transactionManager)
-
-
Method Detail
-
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
-
-