egervari
egervari

Reputation: 22512

How do I map a Map<EnumType, Double> using JPA?

Let's say I have a domain object with the following field:

private Map<StatType, Double> maxValues = new HashMap<StatType, Double>();

StatType is an Java enum.

How do I map this using JPA?

Upvotes: 1

Views: 396

Answers (1)

zeller
zeller

Reputation: 4974

Another post that maybe helps: Storing a Map<String,String> using JPA. This solves the intra-table column-to-column mapping. If you really want to store a Map in a single column, I guess the only possible solution is to store it as a @Lob. An other SO post that describes this, though, in Hibernate: How to persist a HashMap with hibernate

Upvotes: 3

Related Questions