DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Thomas has posted 33 posts at DZone. View Full User Profile

JPA Mapping Of A HashMap Having A Enum Key

05.26.2010
| 7128 views |
  • submit to reddit
        
  @ElementCollection
  @CollectionTable(name="table_name", joinColumns=@JoinColumn(name="owner_fk"))
  @MapKeyColumn(name = "name", length = 50, nullable = false)
  @MapKeyEnumerated(EnumType.STRING)
  @Column(name = "value", length = 100)
  private final Map<KeyEnum, String> metadata = new HashMap<KeyEnum, String>();