Annotation Interface Column


@Target({FIELD,RECORD_COMPONENT}) @Retention(RUNTIME) public @interface Column
Specifies the mapped column for a persistent field.

If no Column annotation is specified, the default values apply.

Usage Example:

 // DB column will have name 'DESC' and DB-specific type 'UTF8'
 @Column(name = "DESC", dbType = DbType.UTF8)
 String description;

 // Subobject's serialized representation will be written to a single BIG_SUBOBJ column
 @Column(name = "BIG_SUBOBJ", flatten = false)
 BigSubobject subobj1;

 // The subobject will be recursively "flattened" into DB columns of primitive types (string,
 // number, boolean). Each column will have the "BIG_SUBOBJ_FLAT" prefix.
 // (flatten=true is default databinding behavior and is shown here for clarity.)
 @Column(name = "BIG_SUBOBJ_FLAT", flatten = true)
 BigSubobject subobj2;
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies custom conversion logic for this column, if any.
    The type of the DB column.
    Defaults to automatically inferred from the field type.
    Qualifier for refining type representation of the DB column.
    Defaults to automatically inferred from the field type.
    boolean
    Determines whether the composite field will be flattened into primitive-typed DB columns (flatten=true); or represented as a single field holding some serialized representation of the field's value (flatten=false).
    Defaults to true (flatten composite fields).
    Changing this parameter for a non-composite field has no effect.
    The name of the DB column.
    Defaults to the field name.
  • Element Details

    • name

      String name
      The name of the DB column.
      Defaults to the field name.
      Default:
      ""
    • dbType

      DbType dbType
      The type of the DB column.
      Defaults to automatically inferred from the field type.
      Default:
      DEFAULT
    • dbTypeQualifier

      String dbTypeQualifier
      Qualifier for refining type representation of the DB column.
      Defaults to automatically inferred from the field type.
      Default:
      ""
    • flatten

      boolean flatten
      Determines whether the composite field will be flattened into primitive-typed DB columns (flatten=true); or represented as a single field holding some serialized representation of the field's value (flatten=false).
      Defaults to true (flatten composite fields).
      Changing this parameter for a non-composite field has no effect.
      Default:
      true
    • customValueType

      CustomValueType customValueType
      Specifies custom conversion logic for this column, if any.
      See Also:
      Default:
      @tech.ydb.yoj.databind.CustomValueType(columnValueType=UNKNOWN, columnClass=java.lang.Comparable.class, converter=tech.ydb.yoj.databind.converter.ValueConverter.NoConverter.class)