private String getSearchPattern(SearchCriteria criteria) {
   if (StringUtils.hasText(criteria.getSearchString())) {
     return "%" + criteria.getSearchString().toLowerCase().replace('*', '%') + "%";
   } else {
     return "%";
   }
 }
 public Page<Hotel> findHotels(SearchCriteria criteria) {
   int page = criteria.getPage();
   int size = criteria.getPageSize();
   System.out.println("page=" + page);
   System.out.println("size=" + size);
   Pageable pageable = new PageRequest(page, size);
   return hotelRepository.findHotels(getSearchPattern(criteria), pageable);
 }
 public Page<Booking> findBookings(SearchCriteria searchCriteria, String username) {
   if (username != null) {
     int page = searchCriteria.getPage();
     int size = searchCriteria.getPageSize();
     Page<Booking> bookingPage =
         bookingRepository.findBookings(username, new PageRequest(page, size));
     return bookingPage;
   }
   return null;
 }