hibernate报错:Use of @OneToMany or @ManyToMany targeting an unmapped class:

报错如下:

 

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 {
//...
}

你可能感兴趣的:(Hibernate)