How to map EnumSet (or List of Enums) in an entity using JPA2

Posted by arteq007 on Stack Overflow See other posts from Stack Overflow or by arteq007
Published on 2010-04-08T11:45:28Z Indexed on 2010/04/08 11:53 UTC
Read the original article Hit count: 341

Filed under:
|
|

I have entity Person:


@Entity
@Table(schema="", name="PERSON")
public class Person {
List<PaymentType> paymentTypesList;

//some other fields

//getters and setters and other logic
}


and I have enum PaymentType:


public enum PaymentType {
FIXED, CO_FINANCED, DETERMINED;
}


how to persist Person and its list of enums (in this list i have to place variable amount of enums, there may be one of them, or two or all of them)

I'm using Spring with Postgres, Entity are created using JPA annotation, and managed using Hibernate

© Stack Overflow or respective owner

Related posts about mapping

Related posts about enumset