package de.thpeetz.kontor.bookshelf.data;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface ArticleRepository extends JpaRepository<Article, String> {

    @Query("select a from Article a " +
            "where lower(a.title) like lower(concat('%', :searchTerm, '%'))")
    List<Article> search(@Param("searchTerm") String searchTerm);

    List<Article> findByTitle(String title);
}
