Enum Class PersistenceContextType
- All Implemented Interfaces:
Serializable, Comparable<PersistenceContextType>, Constable
- A transaction-scoped persistence
context has a lifecycle bound to the current JTA transaction.
The container is responsible for maintaining transactional
affinity when a reference to an
EntityManageris injected. - An extended persistence context has a lifecycle bound to an instance of a stateful session bean and may be inherited by other stateful session beans directly or indirectly instantiated by the first bean.
By default, a container-managed persistence context is
transaction-scoped. The persistence context type for a
container-managed persistence context is specified by
PersistenceContext.type().
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe persistence context exists from the point at which the stateful session bean declaring a dependency on the persistence context is created.A new persistence context begins when the container-managed entity manager is invoked in the scope of an active JTA transaction, and there is no current persistence context already associated with the transaction. -
Method Summary
Modifier and TypeMethodDescriptionstatic PersistenceContextTypeReturns the enum constant of this class with the specified name.static PersistenceContextType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TRANSACTION
A new persistence context begins when the container-managed entity manager is invoked in the scope of an active JTA transaction, and there is no current persistence context already associated with the transaction. The persistence context is created and associated with the transaction. This affinity of the persistence context with the JTA transaction is independent of thesynchronization typeof the persistence context and of whether the persistence context has been joined to the transaction.The persistence context propagates with the current JTA transaction to other injected transaction-scoped entity manager references with the same persistence unit and synchronization type.
The persistence context ends when the associated transaction commits or rolls back, and all entities belonging to the persistence context become detached.
If the entity manager is invoked outside the scope of a transaction, all entities loaded from the database immediately become detached at the end of the method call.
-
EXTENDED
The persistence context exists from the point at which the stateful session bean declaring a dependency on the persistence context is created. The container destroys the persistence context after the@Removemethod of the stateful session bean completes or when the stateful session bean instance is otherwise destroyed.If a stateful session bean instantiates a stateful session bean (executing in the same EJB container instance) which also declares a dependency on an extended persistence context with the same unit and synchronization type, the extended persistence context of the first stateful session bean is inherited by the second stateful session bean. The container does not destroy an extended persistence context until every stateful session bean inheriting the persistence context has been removed or otherwise destroyed.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-