5.15問題彙總

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 索引名 (字段名)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章