Commit b798d001 authored by bangsen.yin's avatar bangsen.yin Committed by Andy Wilkinson

Add missing @Param annotations to CityRepository in Data REST sample

Without the @Param annotations, using either of the search URIs would
resulted in a 400 response and an error describing the lack of @Param
annotation.

See gh-1627
parent d0990c06
...@@ -19,6 +19,7 @@ package sample.data.jpa.service; ...@@ -19,6 +19,7 @@ package sample.data.jpa.service;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import sample.data.jpa.domain.City; import sample.data.jpa.domain.City;
...@@ -26,9 +27,11 @@ import sample.data.jpa.domain.City; ...@@ -26,9 +27,11 @@ import sample.data.jpa.domain.City;
@RepositoryRestResource(collectionResourceRel = "citys", path = "cities") @RepositoryRestResource(collectionResourceRel = "citys", path = "cities")
interface CityRepository extends PagingAndSortingRepository<City, Long> { interface CityRepository extends PagingAndSortingRepository<City, Long> {
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
String country, Pageable pageable); @Param("name") String name, @Param("country") String country,
Pageable pageable);
City findByNameAndCountryAllIgnoringCase(String name, String country); City findByNameAndCountryAllIgnoringCase(@Param("name") String name,
@Param("country") String country);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment