Java – annotate enummap with hibernate annotations
•
Java
Just a simple question:
I want to use enummap in one of my entity classes
Is there a special way to annotate these? What happens if I don't explicitly annotate it?
More specifically, I want the key to be persisted as a string value rather than an int value
Cheers!
Solution
If the key of the map is enumeration, you can use the annotation @ mapkeyenumerated (string) to do this: http://download.oracle.com/javaee/6/api/javax/persistence/MapKeyEnumerated.html
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码