It would be nice to have enumeration type in Hibernate, that is represented not only by int, but also as String.
I have existing database, where enumeration types are stored as strings.
I would appreciate something like this:
Code:
package eg;
import net.sf.hibernate.PersistentStringEnum;
public class Color implements PersistentStringEnum {
private final String code;
private Color(String code) {
this.code = code;
}
public static final Color WHITE = new Color("WH");
public static final Color BLACK = new Color("BL");
public String toString() { return code; }
public static Color fromString(int code) {
.........
}
}
}