@Retention(CLASS) @Target({FIELD})

public @interface Column

Renames or constrains an @Entity field’s column. Optional – when absent, the column name defaults to the field name and the type is inferred from the Java field type (String -> TEXT, int/long -> INTEGER, float/double -> REAL, boolean -> INTEGER, byte[] -> BLOB, java.util.Date -> INTEGER).

Methods

public abstract String name() default ""Column name.
public abstract boolean nullable() default trueWhen false the column gets a NOT NULL constraint at table-create time.
public abstract boolean unique() default falseCreates a unique index when the managed schema is created.
public abstract String type() default ""Optional explicit SQL type.

Method details

name

public abstract String name() default ""
Column name. Defaults to the field name when blank.

nullable

public abstract boolean nullable() default true
When false the column gets a NOT NULL constraint at table-create time.

unique

public abstract boolean unique() default false
Creates a unique index when the managed schema is created.

type

public abstract String type() default ""
Optional explicit SQL type. Use the SQLite type names (TEXT, INTEGER, REAL, BLOB, NUMERIC). When blank the processor infers the type from the field’s Java type.