- All Implemented Interfaces:
Serializable
,Comparable<PersistenceContextScope>
Defines the scope for PersistenceContext.
Ebean has traditionally used Transaction scope for the PersistenceContext. This is used to change the scope to
use (by default) and explicitly set the scope to use for an individual query.
-
Enum Constant Summary
Enum ConstantDescriptionPersistenceContext is scoped to the query.PersistenceContext is scoped to the transaction. -
Method Summary
Modifier and TypeMethodDescriptionstatic PersistenceContextScope
Returns the enum constant of this type with the specified name.static PersistenceContextScope[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
TRANSACTION
PersistenceContext is scoped to the transaction. If a transaction spans 2 or more queries that fetch the same bean in terms of same type and same Id value then they share the same bean instance. You may want to change to use QUERY scope when you want a query executing in a transaction to effectively ignore beans that have already been loaded (by other queries in the same transaction) and instead get a 'fresh copy' of the bean. -
QUERY
PersistenceContext is scoped to the query. This means that for this query running in an existing transaction then it will effectively ignore any beans that have already been queried/loaded by prior queries in the same transaction. You may use QUERY scope on a query that is executed in a transaction and you want to get a 'fresh copy' of the bean.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-