Enum OrderCorrectionType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OrderCorrectionType>

    public enum OrderCorrectionType
    extends java.lang.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:
    OrderCorrection, CollectionMapping
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      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.
      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.
      READ_WRITE
      Order of the list read into application is corrected, and remembered that the invalid list order left in the data base.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static OrderCorrectionType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static OrderCorrectionType[] values()
      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 Detail

      • 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 Detail

      • values

        public static OrderCorrectionType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (OrderCorrectionType c : OrderCorrectionType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OrderCorrectionType valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null