首先,experienceInMonths
从更改String
为int
(否则您无法将字符串与数字进行比较)。然后,您可以尝试使用此“香肠”:
List<Person> findByQualifications_experienceInMonthsGreaterThanAndQualifications_experienceInMonthsLessThanAndName(int experienceGreater, int experienceLess, String name);
或者,您可以尝试使用这种非常不错的方法:
@Query("select p from Person p left join p.qualifications q where q.experienceInMonths > ?1 and q.experienceInMonths < ?2 and q.name = ?3")
List<Person> findByQualification(int experienceGreater, int experienceLess, String name);