报错:
@OneToOne or @ManyToOne on com.it.shop.model.Product.category references an unknown entity: com.it.shop.model.Category
1.检查hibernate.cfg.xml中是否做了mapping
<
mapping
class
=
"com.it.shop.model.Category"
/>
2.检查
@OneToOne or @ManyToOne中targetEntity是否配置
3.检查Class
Category是否添加了注解@Entity
是
@javax.persistence.Entity
不是@org.hibernate.annotations.Entity
@ManyToOne (targetEntity = Category.class)private long cid;
或者使用一下这种写法
@ManyToOne private Category cid;