How to map EnumSet (or List of Enums) in an entity using JPA2
- by arteq007
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