I am developing Spring Boot + Spring Data JPA + Postgres + Lombok example. In this example, I want to fetch all student firstName is ASC order and whose status in Active
.
I developed below query, which works fine, but I dont see a way to also use status=Active
here in JpaRepository
query.
NOTE: In my case, status
field is Enum
in Java.
Is there any way if we can do the same ? I know I can fetch all students and then using streams can easily filter, but using JpaRepository query, is there any way?
List<Student> students = studentRepository.findAll(new Sort(Sort.Direction.ASC, "studentName"));