Enhancement 195 : ENHANCEMENT - Add EnumValue annotation ... to better map enum fields to DB values
Priority 
Medium
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.4.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
17/12/2009
Updated 
17/12/2009
Type 
Enhancement
 
Attachments 
No attachments

EnumValue I suspect is going to be the best/clearest way to explicitly control how enum values are persisted to the DB.

public enum Status {

    @EnumValue("N")
    NEW,
    
    @EnumValue("A")
    ACTIVE,
    
    @EnumValue("I")
    INACTIVE,
}
 
Rob 17 Dec 10:26
So...

So the DB will persist and fetch "N" "A" and "I" ... for NEW, ACTIVE and INACTIVE.

This is likely to be the preferred approach over the existing EnumMapping and standard JPA approaches (Ordinal and String).

Rob 17 Dec 10:27
Fixed in HEAD

This is now in HEAD.

woResponse

Upload a file