springbooot 的JPA实现底层就是hiberate,网上有很多教程,但是要注意以下几个方面。
1. @Id注解是javax.persistence.*包下的,不要用错成别的包
2.如果有jar冲突,需要删除冲突的包,使用我们pom里对应的jar包
3.我们要在启动类上注意吧标明需要扫描的Entity类及resposity所在的包,不然可能会报找不到resposity的错误。
@EnableJpaRepositories("com.example.spring_basic.entity")
@EntityScan("com.example.spring_basic.entity")