我在Repository界面中有查询方法:
public interface StudentRepository extends JpaRepository<Student, Long>, QueryDslPredicateExecutor<Student> {
@Query("select s from Student s join fetch s.subjects join fetch s.teachers where s.firstName = ?1 and s.secondName = ?2")
List<Student> findStudents(String firstName, String secondName)
}
工作正常!
但是我如何使用QueryDSL Predicate而不是参数?
@Query("select s from Student s join fetch s.subjects join fetch s.teachers where s.firstName = ?1 and s.secondName = ?2")
List<Student> findStudents(Predicate predicate)
非常感谢你的想法!