Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.lang.Integer com.dyplom.repository

I have this query in my StudentRepository and I suppose that some mistake in the query :

 @Query("SELECT Student.groupId FROM Student WHERE Student.studentLogin=?1")
Integer getGroupIdByStudentLogin(String studentLogin);

but still can’t find solution to rewrite properly.

Answer

The correct query syntax would be:

@Query("SELECT s.groupId FROM Student s WHERE s.studentLogin=?1")
Integer getGroupIdByStudentLogin(String studentLogin);

See The Java Persistence Query Language for more info.