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


你可能感兴趣的:(problem)