mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
Updated PR based on feedback
Signed-off-by: Perumal Raj A <perumalraj024@gmail.com>
This commit is contained in:
parent
94d6335022
commit
98ccc1e2e4
2 changed files with 1 additions and 6 deletions
|
@ -124,11 +124,6 @@ class OwnerController {
|
||||||
return "owners/ownersList";
|
return "owners/ownersList";
|
||||||
}
|
}
|
||||||
|
|
||||||
// private Page<Owner> findPaginatedForOwnersLastName(int page, String lastname) {
|
|
||||||
// int pageSize = 5;
|
|
||||||
// Pageable pageable = PageRequest.of(page - 1, pageSize);
|
|
||||||
// return owners.findByLastNameStartingWith(lastname, pageable);
|
|
||||||
// }
|
|
||||||
private Page<Owner> findPaginatedForOwnersName(int page, String lastname) {
|
private Page<Owner> findPaginatedForOwnersName(int page, String lastname) {
|
||||||
int pageSize = 5;
|
int pageSize = 5;
|
||||||
Pageable pageable = PageRequest.of(page - 1, pageSize);
|
Pageable pageable = PageRequest.of(page - 1, pageSize);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public interface OwnerRepository extends JpaRepository<Owner, Integer> {
|
||||||
* @return a Collection of matching {@link Owner}s (or an empty Collection if none
|
* @return a Collection of matching {@link Owner}s (or an empty Collection if none
|
||||||
* found)
|
* found)
|
||||||
*/
|
*/
|
||||||
// Page<Owner> findByLastNameStartingWith(String lastName, Pageable pageable);
|
|
||||||
@Query("SELECT o FROM Owner o " + "WHERE LOWER(o.firstName) LIKE LOWER(CONCAT('%', :namePart, '%')) "
|
@Query("SELECT o FROM Owner o " + "WHERE LOWER(o.firstName) LIKE LOWER(CONCAT('%', :namePart, '%')) "
|
||||||
+ "OR LOWER(o.lastName) LIKE LOWER(CONCAT('%', :namePart, '%'))")
|
+ "OR LOWER(o.lastName) LIKE LOWER(CONCAT('%', :namePart, '%'))")
|
||||||
Page<Owner> findByNameContaining(@Param("namePart") String namePart, Pageable pageable);
|
Page<Owner> findByNameContaining(@Param("namePart") String namePart, Pageable pageable);
|
||||||
|
|
Loading…
Reference in a new issue