Annotation Type UpdatableMapping


@Target(METHOD)
@Retention(RUNTIME)
public @interface UpdatableMapping
Specifies the update handling of values assigned to the annotated attribute.
Since:
1.1.0
Author:
Christian Beikov
  • Element Details

    • updatable

      boolean updatable
      Specifies whether the relation for the attribute is updatable. If the attribute maps a *ToOne relation and updatable() is false, the relation isn't updated and the referenced entity unless overridden by cascade() isn't updated either. If it is set to true, at least the relation updated. If the attribute maps a *ToMany relation and updatable() is false, changes to the collection aren't applied to the collection of the backing entity. If it is set to true, at least the collection changes are applied. Unless overridden by this attribute, every attribute that also has a setter is updatable.
      Returns:
      Whether attribute updates are enabled
      Default:
      true
    • orphanRemoval

      boolean orphanRemoval
      Specifies whether an element should be deleted when it is removed/replaced in the attribute value. If the backing entity of the updatable entity view defines orphan removal, this setting must be set to true, otherwise it is a configuration error. The rationale behind this, is that it should be apparent by looking at the attribute definition that orphan removal happens. If this weren't a configuration error, the #FlushStrategy.ENTITY flush strategy would behave differently than other strategies, as the JPA provider would do the orphan removal in case of an update whereas other strategies would adhere to the orphan removal defined on this attribute.
      Returns:
      Whether removed/replaced elements on the attribute should be deleted
      Default:
      false
    • cascade

      CascadeType[] cascade
      The actions that should cascade for the runtime type of objects assigned to the annotated attribute. Allows to override the default cascading strategy for a method attribute.

      The default strategy CascadeType.AUTO causes that attributes that are mutable to cascade all changes. Updatable and non-updatable attributes that have a non-mutable/immutable type do not cascade changes by default.

      An updatable attribute with a non-mutable type can define cascading so that objects of a subtype are persisted or updated. A mutable attribute can be excluded from persisting or updating by annotating an empty array of cascade types.

      Returns:
      The events that should further cascade
      Since:
      1.2.0
      Default:
      {AUTO}
    • subtypes

      Class<?>[] subtypes
      Subtypes of the attribute element type that are allowed to be receive CascadeType.PERSIST and CascadeType.UPDATE cascade events.
      Returns:
      Allowed subtypes for cascading
      Since:
      1.2.0
      Default:
      {}
    • persistSubtypes

      Class<?>[] persistSubtypes
      Subtypes of the attribute element type that are allowed to receive CascadeType.PERSIST cascade events.
      Returns:
      Allowed subtypes for persist cascading
      Since:
      1.2.0
      Default:
      {}
    • updateSubtypes

      Class<?>[] updateSubtypes
      Subtypes of the attribute element type that are allowed to receive CascadeType.UPDATE cascade events.
      Returns:
      Allowed subtypes for update cascading
      Since:
      1.2.0
      Default:
      {}