Annotation Interface MapKeyFormula


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface MapKeyFormula
Specifies an expression written in native SQL that is used to read the key of a Map instead of storing it in a MapKeyColumn.

The expression is evaluated against the table holding the map entries, that is, the collection table, or the table of the target entity for a one-to-many association without a join table:

@OneToMany(mappedBy = "parent")
@MapKeyFormula("upper(code)")
Map<String, Child> children;

Since the key is derived, it is never written to the database.

Since:
8.0
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The formula, written in native SQL.
  • Element Details

    • value

      String value
      The formula, written in native SQL.