@ManyToOne references an unknown entity:
Posted 面具人生lql
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了@ManyToOne references an unknown entity:相关的知识,希望对你有一定的参考价值。
报错: @OneToOne or @ManyToOne on com.it.shop.model.Product.category references an unknown entity: com.it.shop.model.Category1.检查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;
以上是关于@ManyToOne references an unknown entity:的主要内容,如果未能解决你的问题,请参考以下文章
关于An association from the table refers to an unmapped class
object references an unsaved transient instance异常
unity报错NullReferenceException: Object reference not set to an instance of an object
关于An association from the table XX refers to an unmapped class错误
You may experience an access violation when you access an STL object through a pointer or reference