Package org.hibernate.annotations
Annotation Interface ColumnDefault
Specifies that a column has a
default
value specified in DDL.
@ColumnDefault
may be used in combination with:
@DynamicInsert
, to let the database fill in the value of a null entity attribute, or@Generated
, to populate an entity attribute with the defaulted value of a database column.
For example, this field will be populated with the value "new"
by
the database when the entity is inserted:
@Generated @ColumnDefault(value = "'new'") private String status;
If @Generated
is not used, a default
value can cause state
held in memory to lose synchronization with the database.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThedefault
value to use in generated DDL.- Returns:
- a SQL expression that evaluates to the default column value
-