- All Implemented Interfaces:
Serializable,Comparable<OrderCorrectionType>,Constable
The OrderCorrectionType enum is used with OrderCorrection annotation
that could be applied together with OrderColumn annotation.
OrderCorrectionType defines a strategy taken in case the order list read from the database is invalid
(has nulls, duplicates, negative values, values greater/equal to list size -
the only valid order list of n elements is: {0, 1,..., n-1}).
OrderCorrectionType also could be set directly into CollectionMapping using CollectionMapping.setOrderCorrectionType(OrderCorrectionType) method.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDon't correct, throw QueryException with error code QueryException.LIST_ORDER_FIELD_WRONG_VALUEOrder of the list read into application is corrected, but no knowledge is kept about the invalid list order left in the database.Order of the list read into application is corrected, and remembered that the invalid list order left in the database. -
Method Summary
Modifier and TypeMethodDescriptionstatic OrderCorrectionTypeReturns the enum constant of this class with the specified name.static OrderCorrectionType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
READ
Order of the list read into application is corrected, but no knowledge is kept about the invalid list order left in the database. This is no problem in case of a read-only usage of the list, but in case the list is modified and saved back into the database the order likely will not be the same as in cache and will be invalid.This mode is used by default in case the mapped attribute is neither List nor Vector (more precisely: is not assignable from Eclipselink internal class IndirectList).
Example:
a list of three objects: in the database: {null, objectA}; {2, objectB}, {5, ObjectC}; read into application as a list: {objectA, objectB, objectC}; add a new element to the list: {objectA, objectB, objectC, objectD}; updated list saved to the db: {null, objectA}, {2, objectB}, {5, objectC}, {3, objectD}; read again into application: {objectA, objectB, objectD, objectC}; -
READ_WRITE
Order of the list read into application is corrected, and remembered that the invalid list order left in the database. If the list is updated and saved back into the database then all the order indexes are saved ensuring that the list order in the database will be exactly the same as in cache (and therefore valid).This mode is used by default in case the mapped attribute is either List or Vector (more precisely: is assignable from Eclipselink internal class IndirectList).
JPA uses this mode in case OrderCorrection annotation is not specified.
Example:
a list of three objects: in the database: {null, objectA}; {2, objectB}, {5, ObjectC}; read into application as a list: {objectA, objectB, objectC}; add a new element to the list: {objectA, objectB, objectC, objectD}; updated list saved to the db: {0, objectA}, {1, objectB}, {2, objectC}, {3, objectD}; read again into application: {objectA, objectB, objectC, objectD}; -
EXCEPTION
Don't correct, throw QueryException with error code QueryException.LIST_ORDER_FIELD_WRONG_VALUEExample:
a list of three objects: in the database: {null, objectA}; {2, objectB}, {5, ObjectC}; read into application: exception
-
-
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
-