@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Column
Column
annotation is
used for a row class variable, that is equivalent to "@Column" (all defaults are used).
Annotates a class variable.Modifier and Type | Optional Element and Description |
---|---|
FieldAccessType |
fieldAccess
Specifies how the field associated with this column will be accessed.
|
boolean |
identity
Indicates that column is declared as "GENERATED ...
|
java.lang.String |
name
SQL name of column.
|
boolean |
primaryKey
Indicates that column is the primary key for row.
|
boolean |
readOnly
Indicates that column is never modified.
|
java.lang.Class<? extends ColumnTranslator> |
translator
Defines class that will read/write row members from/to database.
|
public abstract java.lang.String name
Field.getName()
or
is obtained from NameTranslator.translate(String, Class)
if translator
is configured for table.public abstract boolean primaryKey
This must be set to true for all columns needed with Table.select(Object...)
or if update or delete operations are to be performed.
public abstract boolean identity
When identity==true, implies that primaryKey==true so that primaryKey does not need to be specified. Only one identity column is allowed per row class.
If true, Connection.prepareStatement(String, int)
will be used to prepare insert
statements to return auto generated keys. Some JDBC drivers do not support auto generated
keys even though the database may allow "GENERATED ... AS IDENTITY ..." in column declaration.
Your driver will report operation not supported or function not supported exceptions if it does
not support auto generated keys.
If false, Connection.prepareStatement(String)
will be used to prepare insert statements.
Connection.prepareStatement(String)
is supported by most JDBC drivers.
Statement.getGeneratedKeys()
public abstract boolean readOnly
public abstract java.lang.Class<? extends ColumnTranslator> translator
Database.initTypeTranslatorMap()
for default translators.public abstract FieldAccessType fieldAccess
Row.fieldAccess()
if fieldAccess()
is not FieldAccessType.Default
.
Use FieldAccessType.Method
to read/write the field value with getter/setter. Public
getter/setter methods are required.
Use FieldAccessType.Direct
to read/write the field value with direct access
Field.equals(Object)
and Field.set(Object, Object)
. No getter/setter are required.
If Column
annotation is not specified or fieldAccess()
is FieldAccessType.Default
,
then Row.fieldAccess()
determines how field is accessed.
FieldAccessType.Method
, FieldAccessType.Direct
, or FieldAccessType.Default