“Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements” in hibernate when annotating a ConcurrentHashMap

Check out the topic 6.1. Persistent collections on this link .

From the link,
Hibernate requires that persistent collection-valued fields be declared as an interface type. The actual interface might be java.util.Set, java.util.Collection, java.util.List, java.util.Map, java.util.SortedSet, java.util.SortedMap or anything you like (“anything you like” means you will have to write an implementation of org.hibernate.usertype.UserCollectionType.)

Leave a Comment