Enum

For Enum types we can use JPA standard @Enumerated or use Ebean specific @DbEnumValue.

 

Example: JPA Standard using Enum name values
@Enumerated(EnumType.STRING)
Status status;

 

Example: Using Ebean @DbEnumValue
public enum Status {
  NEW("N"),
  ACTIVE("A"),
  INACTIVE("I");

  String dbValue;
  Status(String dbValue) {
    this.dbValue = dbValue;
  }

  // annotate a method that returns the value
  // in the DB that the enum element maps to
  @DbEnumValue
  public String getValue() {
    return dbValue;
  }
}