Annotation Interface PropagateNull


@Retention(RUNTIME) @Target({PARAMETER,FIELD,METHOD,TYPE}) public @interface PropagateNull
Signals that a column shows the presence of the mapped type: reflective mappers map a null object if this column is null, rather than a present object with null properties. This is useful e.g. for a LEFT OUTER JOIN or an optionally-present compound value type.

On a type, value() names the column to examine. The name is relative to the prefix of the mapper, which comes from Nested.value() or from a mapper made with a prefix, so the same type can be mapped with different prefixes. Do not include the prefix: if no column matches the name, the annotation has no effect and no error occurs. For the ConstructorMapper, the annotation with a value can also be on the factory method.

On a property (a bean getter or setter, a field, or a constructor parameter), leave value() empty. The mapper examines the value that the column mapper returns for the property, so an Optional property on a null column does not propagate. On a Nested property, the mapper examines the nested object instead.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    On a type, the name of the column to check for null, without the prefix of the mapper.
  • Element Details

    • value

      String value
      On a type, the name of the column to check for null, without the prefix of the mapper. On a property, the value must be empty.
      Returns:
      the column name whose null-ness shall be propagated
      Default:
      ""