Open ph4t opened 9 years ago
Hi.
First of all I'm sorry for taking too much time to answer this issue.
Currently I'm working on migrating all the Java code to Groovy + @CompileStatic
and I'm studying the file in which these mappings are done BidiEnumMap
.
I'm not the original author of this code and I don't remember why we did this but after analyzing the code I think you're right. It seems strange to store the ids instead of just storing the value itself.
I'll ask with @Alotor after my holidays because he did the code but I think we should change this to just store the value.
+1 for String[] Storing enums as positional ints is a dangerous database anti-pattern.
Currently the implementation will serialize an array of enums to an array of ordinal values. Using the Juice enum example from the documentation:
[Juice.ORANGE, Juice.GRAPE]
will be stored as[0, 2]
I think there are a few difficulties with this approach:
[0,2]
stored. If we change the enum toShouldn't we get
[Juice.ORANGE, Juice.APPLE]
instead of original[Juice.ORANGE, Juice.GRAPE]
?Btw, if ordinal values are used, why do we have
value
field inJuice
? Aren't these 2 unrelated?