“非法尝试将非收藏夹映射为@OneToMany、@ManyToMany或@CollectionOfElements”
2022-09-01 03:13:33
早上好,Stackoverflow,
我有一个问题,它给了我错误:
未能创建 sessionFactory object.org.hibernate.AnnotationException:非法尝试将非集合映射为@OneToMany、@ManyToMany或@CollectionOfElements:nl.scalda.pasimo.model.employeemanagement.EducationTeam.coachGroups
你知道为什么吗?
@OneToMany(cascade=CascadeType.ALL, targetEntity=CoachGroup.class)
@JoinColumn(name="id")
private TreeSet<CoachGroup> coachGroups = new TreeSet<>();
private SessionFactory factory;
private void initialiseFactory() {
try {
factory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Failed to create sessionFactory object." + ex);
throw new ExceptionInInitializerError(ex);
}
}