异常:
- Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.chhliu.springbooth2entity.User
- at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:210) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
- at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:70) ~[spring-data-jpa-1.10.6.RELEASE.jar:na]
解决:
1.检查实体类上是否添加注解
@entity 和 @table
2. 定义包扫描注解 实体与数据库表的映射关系 ,扫描实体类的配置路径是否正确
<property name="packagesToScan" value="com.momoj.core.vo" />