From f7346ed776413f85f65c2dfcc5376a30515c1db9 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Mon, 12 Oct 2020 21:35:14 +0300 Subject: [PATCH] Category: return only a single Category object since category is unique Signed-off-by: Pekka Helenius --- .../fjordtek/bookstore/model/book/CategoryRepository.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/CategoryRepository.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/CategoryRepository.java index b9ce44a..6260823 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/CategoryRepository.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/CategoryRepository.java @@ -2,8 +2,6 @@ package com.fjordtek.bookstore.model.book; -import java.util.List; - import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -26,9 +24,9 @@ import org.springframework.data.rest.core.annotation.RestResource; public interface CategoryRepository extends CrudRepository { @RestResource(exported = false) - List findByName(@Param("name") String name); + Category findByName(@Param("name") String name); @RestResource(path = "category", rel = "category") - List findByNameIgnoreCaseContaining(@Param("name") String name); + Category findByNameIgnoreCaseContaining(@Param("name") String name); } \ No newline at end of file