From 566e3198c6a875137ffd572f1357282a077dd020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Kr=C3=ADdl?= <xkridl@fi.muni.cz> Date: Fri, 14 Apr 2023 18:10:23 +0200 Subject: [PATCH] Add CountryRepository --- .../repository/country/CountryRepository.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core/src/main/java/cz/muni/fi/pa165/core/data/repository/country/CountryRepository.java diff --git a/core/src/main/java/cz/muni/fi/pa165/core/data/repository/country/CountryRepository.java b/core/src/main/java/cz/muni/fi/pa165/core/data/repository/country/CountryRepository.java new file mode 100644 index 0000000..011541c --- /dev/null +++ b/core/src/main/java/cz/muni/fi/pa165/core/data/repository/country/CountryRepository.java @@ -0,0 +1,16 @@ +package cz.muni.fi.pa165.core.data.repository.country; + +import cz.muni.fi.pa165.core.data.domain.Country; +import cz.muni.fi.pa165.core.data.repository.common.BaseRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface CountryRepository extends BaseRepository<Country, Long> { + + @Query("SELECT c FROM Country c WHERE c.name = :name") + Optional<Country> findByName(@Param("name") String name); +} -- GitLab