Enum OrderCorrectionType

java.lang.Object
java.lang.Enum<OrderCorrectionType>
org.eclipse.persistence.annotations.OrderCorrectionType
All Implemented Interfaces:
Serializable, Comparable<OrderCorrectionType>

public enum OrderCorrectionType extends Enum<OrderCorrectionType>
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 data base 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 setListOrderCorrectionType method.
See Also:
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Don't correct, throw QueryException with error code QueryException.LIST_ORDER_FIELD_WRONG_VALUE Example: a list of three objects: in the data base: {null, objectA}; {2, objectB}, {5, ObjectC}; read into application - exception.
    Order of the list read into application is corrected, but no knowledge is kept about the invalid list order left in the data base.
    Order of the list read into application is corrected, and remembered that the invalid list order left in the data base.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • READ

      public static final OrderCorrectionType READ
      Order of the list read into application is corrected, but no knowledge is kept about the invalid list order left in the data base. 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 data base 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 data base: {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

      public static final OrderCorrectionType READ_WRITE
      Order of the list read into application is corrected, and remembered that the invalid list order left in the data base. If the list is updated and saved back into the data base then all the order indexes are saved ensuring that the list order in the data base 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). This mode is used in JPA in case OrderCorrection annotation is not specified. Example: a list of three objects: in the data base: {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

      public static final OrderCorrectionType EXCEPTION
      Don't correct, throw QueryException with error code QueryException.LIST_ORDER_FIELD_WRONG_VALUE Example: a list of three objects: in the data base: {null, objectA}; {2, objectB}, {5, ObjectC}; read into application - exception.
  • Method Details

    • values

      public static OrderCorrectionType[] 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

      public static OrderCorrectionType valueOf(String name)
      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 name
      NullPointerException - if the argument is null