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

后端 未结 1 1668
北恋
北恋 2020-12-03 08:07

I\'ve tried annotating a property accessor whose return value is a map as follows:

@MapKeyColumn(name=\"parameter_name\")
@ElementCollection
public Concurren         


        
1条回答
  •  有刺的猬
    2020-12-03 08:24

    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.)

    0 讨论(0)
提交回复
热议问题