Another thing I was just thinking about.  The current implementation
is somewhat fragile.  When persisting the enumerated value, for an int
column it calls value.ordinal(), which returns the zero-based index of
the value of the enum, as it is declared in the class.

Given:

public enum Color { Red, Green, Blue }

Cayenne would persist Red=>0, Green=>1, Blue=>2, but if someone later
changed the enum to be:

public enum Color { Red, White, Green, Blue }

Well, things start falling apart at that point.  The values of Green
and Blue have been changed, but from a Java-perspective, all seems
fine.

/dev/mrg

Reply via email to