diff --git a/driver/src/main/java/cz/muni/pa165/driver/data/repository/DriverRepository.java b/driver/src/main/java/cz/muni/pa165/driver/data/repository/DriverRepository.java index 6a5eb0cd0eef31040355dec815d53a3840791106..002cfef7d9652e47ed3862ba10c63f0c073cce6b 100644 --- a/driver/src/main/java/cz/muni/pa165/driver/data/repository/DriverRepository.java +++ b/driver/src/main/java/cz/muni/pa165/driver/data/repository/DriverRepository.java @@ -2,12 +2,23 @@ package cz.muni.pa165.driver.data.repository; import cz.muni.pa165.driver.data.model.Driver; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; +import java.util.List; +import java.util.Optional; + /** * Repository for driver. */ @Repository public interface DriverRepository extends JpaRepository<Driver, Long> { + @Query("SELECT d FROM Driver d WHERE d.id = :id") + Optional<Driver> findById(@Param("id") Long id); + + @Query("SELECT d FROM Driver d") + List<Driver> findAll(); + }