[jboss-user] [JBoss Seam] - Re: How to persist entities that have arrays or collections

christian.bauer@jboss.com do-not-reply at jboss.com
Wed Jun 20 11:59:22 EDT 2007


If an entity class has a property of type Enum, you can use @Enumerated(EnumType.STRING). Ordinal representation is even the default. So this is basic Java Persistence and you need to do nothing except put a property in an entity class that is of Enum type.

There is no support for storing a collection of Enum objects - the point of an enumeration is really that you pick _one_. I can imagine that you can use @CollectionOfElements and a Hibernate UserType that maps the collection element. This is outside of the scope of JPA. 

I don't know any other documentation that would get you as close to this goal as my book although there is no direct example of doing this in it. There is a UserType for enumerations in it and examples how to use @CollectionOfElements.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056102#4056102

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056102



More information about the jboss-user mailing list