Hibernate JPA does this well with a custom annotation @CollectionOfElements Maybe something similar can be done for OpenJPA.
- Brill Pappin On Tue, May 6, 2008 at 5:10 AM, Michael Vorburger <[EMAIL PROTECTED]> wrote: > Amit, > >> I imagine I do not need a join table, but a child table that has the > owner entity ID, Enumerated >> String Value and a Sequence, but I do not know how to represent that > in a @OneToMany annotation. > > This looks a bit like my "Re: One-Sided One-Many Mapping, but to > different tables - missing @ElementEmbeddedMapping ?" thread (monologue, > almost). With the latest trunk and upcoming 1.1 version of OpenJPA you > can use @ContainerTable instead of @OneToMany it seems for this kind of > mapping. However, I have no idea if that would work, or is even needed, > for a Collection/List of enum. > > Regards, > Michael > > > -----Original Message----- > From: Patel Amit [mailto:[EMAIL PROTECTED] > Sent: vendredi, 2. mai 2008 23:44 > To: [email protected] > Subject: List mapping of Enumerated Types > > Hello Jpa Community, > > I have a question on how to annotate a Collection of enums in my Entity. > > I have an Entity which has a List of Enums: > > private List<KeyUsuage> keyUsuage = new ArrayList<KeyUsuage>(); > > Where KeyUsuage is the following enum: > > public enum KeyUsuage > { > digitalSignature, > nonRepudiation, > keyEncipherment, > dataEncipherment, > keyAgreement, > keyCertSign, > CRLSign, > encipherOnly, > decipherOnly, > AllExtendedKeyUsage; > } > > How do I go about mapping this to a table. I imagine I do not need a > join table, but a child table that has the owner entity ID, Enumerated > String Value and a Sequence, but I do not know how to represent that in > a @OneToMany annotation. > > Has anyone done this before or know how to do it? Is this possible in > JPA? > > Thanks for the help. > > Amit > > > ____________________________________________________________ > > • This email and any files transmitted with it are CONFIDENTIAL and intended > solely for the use of the individual or entity to which they are addressed. > • Any unauthorized copying, disclosure, or distribution of the material within > this email is strictly forbidden. > • Any views or opinions presented within this e-mail are solely those of the > author and do not necessarily represent those of Odyssey Financial > Technologies SA unless otherwise specifically stated. > • An electronic message is not binding on its sender. Any message referring to > a binding engagement must be confirmed in writing and duly signed. > • If you have received this email in error, please notify the sender > immediately > and delete the original. >
