“Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements”

前端 未结 5 1611
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 16:27

Good morning Stackoverflow,

I have the problem that it gives me the error:

Failed to create sessionFactory object.org.hibernate.AnnotationExcept

5条回答
  •  时光取名叫无心
    2021-01-31 17:07

    Another possible reasons for this exception to occur is using a non-collection object for @ManyToMany and@OneToMany mappings Or using collection object for @ManyToOne and @OneToOne mappings. All examples below are incorrect.

    INCORRECT

     @ManyToMany
     private User user;
    
     @ManyToOne
     private User user;
    
     @OneToOne
     private List users;
    
     @ManyToOne
     private List users;
    

提交回复
热议问题