|
You will get the ConcurrentModificationException exception (stacktrace http://pastebin.com/21qJpLHe) if you try create mapping for the entity with list of embeddable with map of enum-string
------------------------------------------------------------ @Entity @Table(name = "ITEM") public class Item { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID") protected long id;
@ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "IMAGE", joinColumns = @JoinColumn(name = "ITEM_ID")) private List<Image> images; Item() {}
} ------------------------------------------------------------ @Embeddable public class Image { @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "IMAGE_METADATA", joinColumns = @JoinColumn(name = "IMAGE_ID")) @MapKeyColumn(name = "IMAGE_PROPERTY") @MapKeyEnumerated(EnumType.STRING) @Column(name = "PROPERTY_VALUE") private Map<ImageProperty, String> metadata;
Image() {} } ------------------------------------------------------------ public enum ImageProperty { SIZE_X, SIZE_Y; }
------------------------------------------------------------ You may get the bug example on the next project (https://bitbucket.org/senleft/hibernate4tutorial) on the model.dao.mappings.collections.nestedmapofembedables.bug.MappingTest.java
|