最近使用hibernate4注解写demo的时候出现了org.hibernate.MappingException: Unknown entity
一般原因是注解@Entity引入包错误,这儿使用注解应该是import javax.persistence.Entity;不是hibernate下的,
另外就是映射错误
上面 的红框中的需要写具体的包名,同一包下的实体不能为了省事使用*代替,这样写就会报上面的错误,不写也是一样
最近使用hibernate4注解写demo的时候出现了org.hibernate.MappingException: Unknown entity
一般原因是注解@Entity引入包错误,这儿使用注解应该是import javax.persistence.Entity;不是hibernate下的,
另外就是映射错误
上面 的红框中的需要写具体的包名,同一包下的实体不能为了省事使用*代替,这样写就会报上面的错误,不写也是一样