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 7fe6657..50d776e 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/BookRepository.java @@ -2,15 +2,21 @@ package com.fjordtek.bookstore.model; +import java.util.List; import java.util.Optional; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; +@RepositoryRestResource public interface BookRepository extends CrudRepository { @Override public Optional findById(Long id); + public List findByTitle(@Param("title") String title); + /* 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, * this method must be changed, as well. Since database allows only UNIQUE values for ISBNs