@RepositoryRestResource
public interface EmployeeRepository extends JpaRepository<Employee, Integer> {
@Query("SELECT employee FROM Employee employee")
List<Employee> getAll();
Page<Employee> findAll(Example<Employee> employeeExample, Pageable pageable);
}
If I call :
.../api/employees/search/getAll
it gives me the result of getAll
method
However JpaRepository has same function but I am unable to call it:
.../api/employees/search/findAll
Fortunately, I was able to write a @Query
method that have same functionality.
But now I need to call this method from QueryByExampleExecutor
(JpaRepository extends this interface)
<S extends T> Page<S> findAll(Example<S> var1, Pageable var2);
I wrote some function to EmployeeRepository, in order to call it as rest endpoint.
Page<Employee> findAll(Example<Employee> employeeExample, Pageable pageable);
But I get the bellow error:
findAll(Example, Pageable)' in 'com.foo.repository.EmployeeRepository' clashes with 'findAll(Example, Pageable)' in 'org.springframework.data.repository.query.QueryByExampleExecutor'; both methods have same erasure, yet neither overrides the other
I can not write a @Query
method that has same functionality with that method.
How can I call inherited repository methods as a Rest Enpoint in Spring-Data ?