I would like to use Character, as opposed to String or Integer, as a backing field for enums. This keeps the database somewhat legible, while saving space. (A character can be more descriptive and take up less space than an integer, much less than a string.)
I tried defining the enum like this (really, nothing more than replacing String with Character and double quotes with single quotes):
public enum Axis implements EnumClass<Character> {
ROWS('R'),
COLS('C');
private Character id;
Axis(Character value) { this.id = value; }
public Character getId() { return id; }
@Nullable
public static Axis fromId(Character id) {
for (Axis at : Axis.values()) if (at.getId().equals(id)) return at;
return null;
}
}
and the entity field like this:
@NotNull
@Column(name = "AXIS", nullable = false)
private Character axis;
public Axis getAxis() { return axis == null ? null : Axis.fromId(axis); }
public void setAxis(Axis axis) { this.axis = axis == null ? null : axis.getId(); }
But when I try to use the Designer pane for the entity I get the following error:
Entity commit error. See log for details.
(no indication of where to find the log)
Is this not supported, as I fear? Could you add support for it?