@Retention(value=RUNTIME) @Target(value=METHOD) public @interface DbEnumValue
This is the preferred option for mapping Enum's to DB values (preferred over the JPA standard @Enumerated and Ebean's @EnumValue annotations).
public enum Status {
NEW("N"),
ACTIVE("A"),
INACTIVE("I");
String dbValue;
Status(String dbValue) {
this.dbValue = dbValue;
}
@DbEnumValue
public String getValue() {
return dbValue;
}
}
| Modifier and Type | Optional Element and Description |
|---|---|
DbEnumType |
storage
Specify the database type used to store the values (VARCHAR or INTEGER).
|
public abstract DbEnumType storage
Copyright © 2016. All rights reserved.