[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to store an ArrayList of Enum Values?

In EclipseLink you could use a @BasicCollection for this.  You would use a
EnumTypeConverter to convert the Enum.  This mapping uses a separate table
to store the values.

You could also just serialize the collection to a binary field, but this
would not allow querying.

You could also instead change the Enum to a class and make it an Entity and
define a OneToMany or ManyToMany to it.

t3_chris wrote:
> Hi!
> I'am heavily using constructs like this to store Enum Values to the
> Database.
> @Column(name = "customer_status", nullable = false)
> @Enumerated(EnumType.STRING)
> private CustomerStatus status;
> Now, i am in need to store an ArrayList, or List or Collection of serveral
> of those Enum Values.
> Can this be done with EclipseLink 1.0 ?
> If yes, how?
> I need something like:
> @Enumerated(EnumType.STRING)
> private ArrayList<CustomerStatus> customerStati;
> How should the databasetable be designed for such thing?
> Best Regards,
> christian

http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
View this message in context: http://www.nabble.com/How-to-store-an-ArrayList-of-Enum-Values--tp19051233p19069911.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.