This is currently supported in openjpa trunk.
@ElementCollection
@Enumerated(EnumType.STRING)
protected List<CreditRating> cr = new ArrayList<CreditRating>();
where
public enum CreditRating { POOR, GOOD, EXCELLENT };
Regards,
Fay
----- Original Message ----
From: Matthew Adams <[email protected]>
To: [email protected]
Sent: Thursday, September 3, 2009 1:00:59 PM
Subject: Collection of enums: supported yet?
Hi all,
I searched the mailing list to determine the OpenJPA metadata required
to store a collection of an enum type (ie, Collection<Color>,
Set<Color>, List<Color>), and I noticed that Patrick answered a while
ago (ca. 2007) that Kodo supports it but not OpenJPA.
Is this still the case? I can't find doc in the OpenJPA reference
guide that explains how to map collections of enums.
I don't really need EnumSet or EnumMap, either. A plain, old
Collection<Color> will do fine.
If it's currently supported, how to I configure OpenJPA to store the
values of an enum in a collection as that enum's name()?
Thanks,
Matthew
--
mailto:[email protected]
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:[email protected]
msn:[email protected]
http://matthewadams.me
http://www.linkedin.com/in/matthewadams