Package org.hibernate.annotations

Annotation Type ColumnDefault


  • @Target({FIELD,METHOD})@Retention(RUNTIME)public @interfaceColumnDefault
    Specifies that a column has adefault 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.

    If@Generated is not used, adefault value can cause state held in memory to lose synchronization with the database.

    See Also:
    GeneratedColumn,DialectOverride.ColumnDefault
    • Required Element Summary

      Required Elements 
      Modifier and TypeRequired ElementDescription
      Stringvalue
      Thedefault value to use in generated DDL.
    • Element Detail

      • value

        String value
        Thedefault value to use in generated DDL.
        Returns:
        a SQL expression that evaluates to the default column value