org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.yunrui.weixin.user.pojo.User
運行項目會出現(xiàn)這種錯誤。哪里出錯球切?绒障?吨凑?
1.模型類有添加@Entiy注解么端盆,有
2.看看是不是ID 導(dǎo)包倒錯了费封,一定要注意是
導(dǎo)入javax.persistence.Id;
果然 隨手寫了一個
import org.springframework.data.annotation.Id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;