Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


@OrderCorrection

Use @OrderCorrection to specify a strategy to use if the order list read from the database is invalid (for example, it has nulls, duplicates, negative values, or values greater than or equal to the list size).

To be valid, an order list of n elements must be {0, 1,..., n-1}


Annotation Elements

Table 2-46 describes this annotation's elements.

Table 2-46 @OrderCorrection Annotation Elements

Annotation Element Description Default

value

(Optional) Specify a strategy to use if the order list read from the database is invalid:

  • EXCEPTION

  • READ

  • READ_WRITE

READ_WRITE



Usage

When using @OrderCorrection, you can specify how EclipseLink should handle invalid list orders:


Examples

Example 2-85 shows how to use this annotation.

Example 2-85 Using @OrderCorrection Annotation

@OrderColumn(name="ORDER_COLUMN")
@OrderCorrection(EXCEPTION)
List<String> designations;

Example 2-86 shows how to use this extension in the eclipselink-orm.xml file.

Example 2-86 Using <element-collection> in XML

<element-collection name="designations">
    <order-column name="ORDER_COLUMN" correction-type="EXCEPTION"/>
</element-collection>


See Also

For more information see: