I need help with storing a map in JPA2, where both keys and values are enums (Map<Enum, Enum>
). With Hibernate as my JPA provider it stores the enums as a blob but I need the data stored as strings. I tried the following annotations to fix this problem:
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyEnumerated(value = EnumType.STRING)
public Map<Enum, Enum> getElementsMap() {
return elementsMap;
}
But the data is still being stored into the DB as blob. Has anyone solved this problem?
toString()
on both the keys and values. What's the problem?