I have an enum mapped as a CollectionOfElements like:
private Set<MyEnum> type = EnumSet.noneOf(MyEnum.class);
@CollectionOfElements(fetch = FetchType.LAZY)
@JoinTable( name="enumtable",
joinColumns = { @JoinColumn( name="id") })
public Set<MyEnum> getType() {
return type;
}
This allows me to save multiple enummerated types for a given entry e.g.
parent.setType(EnumSet.of(Style.BOLD, Style.ITALIC));
I am also able to search using the ordinal value of the enum (not sure if this is the recommned approach - I am sure I will be told otherwise...)
What I am unable to do, however, is return and instance of the parent object (the one that has owns the CollectionOfElements) and get the type.
java.lang.IllegalArgumentException: Unknown name value for enum class.
Is there a way I can declare that the Set I am saving/retrieving is of an enum type, maybe using somethign like: @Enumerated(value=EnumType.ORDINAL)
|