Annotation Type MappingIndex


@Target({METHOD,PARAMETER,FIELD}) @Retention(RUNTIME) public @interface MappingIndex
A mapping to a JPQL expression which contains references to fields of the target entity/association. The MappingIndex annotation can be applied to abstract getter methods of an interface or abstract class. It may also be applied to constructor parameters. The use of the MappingIndex annotation is optional when the Mapping annotation refers to an indexed collection and the Java type is of the same indexed collection type. Example 1: public List<String> getOrderedNames(); Example 2: @MappingIndex("INDEX(this)") @Mapping("UPPER(orderedNames)") public List<String> getOrderedUpperName(); Example 1 shows a getter which implicitly uses the mapping index of the backing "orderedNames" collection. Example 2 explicitly defines the mapping for the index based on the index of the "orderedNames" collection.
Since:
1.5.0
Author:
Christian Beikov
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The associations of the entity that should be fetched.
    The JPQL expression mapping the index value of the annotated getter or parameter should map to.
  • Element Details

    • value

      String value
      The JPQL expression mapping the index value of the annotated getter or parameter should map to.
      Returns:
      The JPQL expression mapping
      Default:
      ""
    • fetches

      String[] fetches
      The associations of the entity that should be fetched. This is only valid if the mapping refers to an entity and is mapped as attribute with the original type.
      Returns:
      The associations of the entity that should be fetched
      Default:
      {}