1、springboot報 org.hibernate.AnnotationException: No identifier specified for entity: com.lz.test.entity
solve:在entity上的自增id上加上
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(unique=true, nullable=false)
2、 spring boot jpa-java.lang.IllegalArgumentException: Not a managed type
solve:
@EntityScan(basePackages="com.lz.test.entity")
3、springboot中dao層@Query的sql報錯
solve:
@Query(value = "select * from book where price = ?1",nativeQuery = true)
4、java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'bookController' method
solve:不能同時映射一個名字(@RequestMapping("/***"))
5、慢SQL問題
1)先去表中查找表中的索引
2)where語句中沒有索引的字段添加索引
例如:alter table 表名 add index 索引名 (字段名)