diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-07-23 23:19:45 +1000 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-07-23 23:19:45 +1000 |
| commit | fa34f76ad8ebccb96012b45a4207532846cfa03f (patch) | |
| tree | e11e7a675d8d23a4921be505cec16b735abbd23d /src/main/java/com/stileeducation/markr/repository/TestResultRepository.java | |
| parent | 6964e0bc8578abcbdf7e49ffa36c49197df67787 (diff) | |
Define JPA entities and repositories and H2 DB
Diffstat (limited to 'src/main/java/com/stileeducation/markr/repository/TestResultRepository.java')
| -rw-r--r-- | src/main/java/com/stileeducation/markr/repository/TestResultRepository.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/com/stileeducation/markr/repository/TestResultRepository.java b/src/main/java/com/stileeducation/markr/repository/TestResultRepository.java new file mode 100644 index 0000000..5810f8e --- /dev/null +++ b/src/main/java/com/stileeducation/markr/repository/TestResultRepository.java @@ -0,0 +1,19 @@ +package com.stileeducation.markr.repository; + +import com.stileeducation.markr.entity.Student; +import com.stileeducation.markr.entity.Test; +import com.stileeducation.markr.entity.TestResult; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; +import java.util.Optional; + +public interface TestResultRepository extends JpaRepository<TestResult, Long> { + + Optional<TestResult> findByStudentAndTest(Student student, Test test); + + @Query("SELECT tr FROM TestResult tr WHERE tr.test.testId = :testId") + List<TestResult> findAllByTestId(@Param("testId") String testId); +} |
