Reputation: 125
I am developing an application with spring boot. While using JPA, i am getting error that error in SQL syntax.
public interface ReservoirRepository extends CrudRepository<Reservoir, Integer> {
@Query(value = "From reservoir where patientID = ?1", nativeQuery = true)
public List<Reservoir> findByPatientId(Integer patientId);
}
Here is the MySQL table and data
The error description is like this
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
Please help me i am not getting what's wrong here. Thanks :)
Upvotes: 0
Views: 418
Reputation: 373
Write the full sql command, as its native query. Like @Query(value = "SELECT * FROM Reservoir res where res.patientID = ?1", nativeQuery = true)
Upvotes: 1