Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0
-
None
-
All
Description
Current Cayenne support for Java 1.5 enumerations is relatively simplistic. Given:
enum Color
{ RED, GREEN, BLUE }Cayenne will store 0, 1, and 2 (respectively) for a numeric column, or "RED", "GREEN", and "BLUE" for a string column. There is no way to specify your own values for the enumerations, which is especially important when mapping to an existing schema. Also, in the case of numeric types, the order they are declared is fragile. If someone later sorts the colors to be BLUE, GREEN, RED, then the values of BLUE and RED will be swapped (and incorrect) on future reads from the database.
Cayenne needs to be able to support explicitly mapping the enumeration to the database value.