From e430378fdfb078b7ffefc56abb4f6911e0268bff Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Wed, 23 Sep 2020 01:21:16 +0300 Subject: [PATCH] Modify findById method Signed-off-by: Pekka Helenius --- .../java/com/fjordtek/bookstore/model/BookRepository.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java index 75f6367..7fe6657 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java @@ -2,13 +2,14 @@ package com.fjordtek.bookstore.model; -import java.util.List; +import java.util.Optional; import org.springframework.data.repository.CrudRepository; public interface BookRepository extends CrudRepository { - public List findById(String title); + @Override + public Optional findById(Long id); /* Assume a single book with a single ISBN, or multiple books with possibly duplicate ISBNs? * For meanwhile, we have a UNIQUE constraint for ISBN values. If this policy changes,