@Query("select b from Blog b where b.recommend = true")
List<Blog> findTop(Pageable pageable);
比如在这里编译器出现,Blog.can’t resolve symbol的报错。可用以下方法解决
1.https://stackoverflow.com/questions/12420996/intellij-idea-highlights-entity-class-names-with-cannot-resolve-symbol-in-jpq步骤 File > Project Structure > Facets. Then click on the + icon and add JPA to your project/module.
2.配置idea中的数据库
选择MySQL后
根据你的数据库信息配置,配置完成后点击Test Connection测试是否成功。如果不成功,再设置一下serverTimezone为UTC
3.@Entity注释指名这是一个实体Bean,@Table注释指定了Entity所要映射带数据库表,注意在idea中创建实体类使用@Table注解时,因为报错而把name写到@Entity上要改到@Table上。
解决@Table出现的报错
左侧会出现
选择mysql,再回去看飘红就没啦