Package io.ebean.annotation
Annotation Type DbEnumValue
-
@Retention(RUNTIME) @Target(METHOD) public @interface DbEnumValue
Specify a method on an Enum that returns the value that should be stored in the DB.This is the preferred option for mapping Enum's to DB values (preferred over the JPA standard @Enumerated and Ebean's @EnumValue annotations).
Example:
{@code public enum Status { NEW("N"), ACTIVE("A"), INACTIVE("I"); String dbValue; Status(String dbValue) { this.dbValue = dbValue; }
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description intlengthThe column length for VARCHAR.DbEnumTypestorageSpecify the database type used to store the values (VARCHAR or INTEGER).booleanwithConstraintWhen true DDL should generate a database constraint for the enum values.
-
-
-
Element Detail
-
storage
DbEnumType storage
Specify the database type used to store the values (VARCHAR or INTEGER).- Default:
- io.ebean.annotation.DbEnumType.VARCHAR
-
-
-
length
int length
The column length for VARCHAR.When 0 the length is determined automatically based on the maximum length of the values used.
Specify this to allow for future string enum values that might be larger then the automatically determined maximum length.
- Default:
- 0
-
-
-
withConstraint
boolean withConstraint
When true DDL should generate a database constraint for the enum values.- Default:
- true
-
-