Package tech.ydb.yoj.databind.schema
Annotation Interface Column
Specifies the mapped column for a persistent field.
If no Column annotation is specified, the default values apply.
This is a meta-annotation: it can be applied to other annotations; if you use these annotations,
YOJ will correctly apply the @Column annotation. This allows you to define reusable column customizations.
See e.g. @ObjectColumn.
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 ElementsModifier and TypeOptional ElementDescriptionSpecifies 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.booleanDetermines whether thecomposite fieldwill be: flattened into multiple primitive-typed DB columns (flatten=true), or represented as a single column holding the serialized representation of the field's value (flatten=false). Defaults totrue(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 nameThe name of the DB column.
Defaults to the field name.- Default:
- ""
-
dbType
DbType dbTypeThe type of the DB column.
Defaults to automatically inferred from the field type.- Default:
- DEFAULT
-
dbTypeQualifier
String dbTypeQualifierQualifier for refining type representation of the DB column.
Defaults to automatically inferred from the field type.- Default:
- ""
-
flatten
boolean flattenDetermines whether thecomposite fieldwill be:- flattened into multiple primitive-typed DB columns (
flatten=true), - or represented as a single column holding the serialized representation of the field's value
(
flatten=false).
true(flatten composite fields).
Changing this parameter for a non-composite field has no effect.Tip: Use the
@ObjectColumnannotation if you only need to override@Column.flattentofalse.- Default:
- true
- flattened into multiple primitive-typed DB columns (
-
customValueType
CustomValueType customValueTypeSpecifies custom conversion logic for this column, if any.- See Also:
- Default:
- @tech.ydb.yoj.databind.CustomValueType(columnClass=java.lang.Comparable.class, converter=tech.ydb.yoj.databind.converter.ValueConverter.NoConverter.class)
-