您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何使用JpaRepository和对象的嵌套列表进行搜索?

如何使用JpaRepository和对象的嵌套列表进行搜索?

首先,experienceInMonths从更改Stringint(否则您无法将字符串与数字进行比较)。然后,您可以尝试使用此“香肠”:

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);
其他 2022/1/1 18:18:37 有406人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶