報錯如下:
org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class:
pp.entity.Employee.departments[pp.entity.Department]
1.hibernate.cfg.xml忘記了:
<session-factory>
<mapping class="pp.entity.Department"/>
</session-factory>
2.忘記了注解:
@Entity
@Table
public class Department {
//...
}