Hi,
I'm trying to have all data related code reside in the repository layer and not spill out into the service layer.
I have a service method using only primitive types:
And a repository method routing it to a standard Jpa method:
With the following method in the repository interface:
But the service method sees the repository interface method instead of the repository implementation one.
I'm trying to have all data related code reside in the repository layer and not spill out into the service layer.
I have a service method using only primitive types:
Code:
public List<Admin> search(String searchTerm, int pageIndex, int pageSize) {
return adminRepository.search(searchTerm, pageIndex, pageSize);
}
Code:
public List<Admin> search(String searchTerm, int pageIndex, int pageSize) {
Pageable pageSpec = buildPageSpecification(pageIndex, pageSize);
Page wanted = search(searchTerm, pageSpec);
return wanted.getContent();
}
Code:
@Query("SELECT a FROM Admin a WHERE LOWER(a.firstname) LIKE LOWER(:searchTerm) OR LOWER(a.lastname) LIKE LOWER(:searchTerm) ORDER BY a.lastname ASC, a.firstname ASC")
public List search(@Param("searchTerm") String searchTerm, Pageable page);