Tag Archives: Use of @OneToMany or @ManyToMany targeting an unmapped class

Use of @OneToMany or @ManyToMany targeting an unmapped class: com.xxx.domain Error

Solution:

1. Make sure that the annotation is javax. Persistence. Entity, not org. Hibernate. Annotations. Entity
2. If you list your entities manually (in persistence.xml, in hibernate.cfg.xml, or in configuring your session factory), then make sure that you also list the entities
3. Make sure that you don’t have more XX classes in different packages, and you have entered the wrong one (Key points)