Skip to content

Commit 368d083

Browse files
committed
revert changes to gey surveys queries
1 parent 282c43e commit 368d083

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/main/java/com/pwr/students/repository/SurveyRepository.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,4 @@ default Page<Survey> findAllWithEagerRelationships(Pageable pageable) {
4040

4141
@Query("select survey from Survey survey left join fetch survey.user where survey.id =:id")
4242
Optional<Survey> findOneWithToOneRelationships(@Param("id") Long id);
43-
44-
@Query("SELECT DISTINCT s FROM Survey s LEFT JOIN FETCH s.questions")
45-
List<Survey> findAllWithQuestions();
46-
47-
@Query("SELECT s FROM Survey s LEFT JOIN FETCH s.questions WHERE s.id = :surveyId")
48-
Optional<Survey> findOneWithQuestions(@Param("surveyId") Long surveyId);
4943
}

src/main/java/com/pwr/students/web/rest/SurveyResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public ResponseEntity<Survey> partialUpdateSurvey(
158158
public List<Survey> getAllSurveys(@RequestParam(required = false, defaultValue = "true") boolean eagerload) {
159159
log.debug("REST request to get all Surveys");
160160
if (eagerload) {
161-
return surveyRepository.findAllWithQuestions();
161+
return surveyRepository.findAllWithEagerRelationships();
162162
} else {
163163
return surveyRepository.findAll();
164164
}
@@ -173,7 +173,7 @@ public List<Survey> getAllSurveys(@RequestParam(required = false, defaultValue =
173173
@GetMapping("/surveys/{id}")
174174
public ResponseEntity<Survey> getSurvey(@PathVariable Long id) {
175175
log.debug("REST request to get Survey : {}", id);
176-
Optional<Survey> survey = surveyRepository.findOneWithQuestions(id);
176+
Optional<Survey> survey = surveyRepository.findOneWithEagerRelationships(id);
177177
return ResponseUtil.wrapOrNotFound(survey);
178178
}
179179

0 commit comments

Comments
 (0)