【发布时间】:2019-12-14 13:45:01
【问题描述】:
我正在使用 Spring Boot 开发应用程序。在使用 JPA 时,我在 SQL 语法中遇到错误。
public interface ReservoirRepository extends CrudRepository<Reservoir, Integer> {
@Query(value = "From reservoir where patientID = ?1", nativeQuery = true)
public List<Reservoir> findByPatientId(Integer patientId);
}
这是 MySQL 表和数据
错误描述是这样的
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From reservoir where patientID = 1' at line 1
请帮助我,我没有弄明白这里有什么问题。谢谢:)
【问题讨论】:
标签: java mysql spring-boot jpa spring-data-jpa