Hibernate映射Map <enum,double> </enum,double>

时间:2013-10-24 09:30:59

标签: hibernate jpa annotations

我如何在Hibernate中映射它:

 Map<Day, Double> dayCounter;

Day是:

public enum Day {

    MONDAY,

    TUESDAY,

    WEDNESDAY,

    THURSDAY,

    FRIDAY;
}

1 个答案:

答案 0 :(得分:1)

类似的东西:

   @ElementCollection
   //define your collection table using @CollectionTable
   @MapKeyEnumerated(EnumType.STRING)
   @MapKeyColumn(name = "day")
   @Column(name = "count")
   private Map<Day, Double> dayCount;