diff --git a/.github/workflows/boot-graphql-webmvc.yml b/.github/workflows/graphql-boot-webmvc.yml
similarity index 89%
rename from .github/workflows/boot-graphql-webmvc.yml
rename to .github/workflows/graphql-boot-webmvc.yml
index 1f14e7cf4..9cef11de1 100644
--- a/.github/workflows/boot-graphql-webmvc.yml
+++ b/.github/workflows/graphql-boot-webmvc.yml
@@ -25,11 +25,11 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- - name: Set up JDK 17
+ - name: Set up JDK 21
uses: actions/setup-java@v3.13.0
with:
- java-version: 17
- distribution: "zulu"
+ java-version: 21
+ distribution: "microsoft"
cache: "maven"
- name: Grant execute permission for mvnw
diff --git a/graphql/boot-graphql-webmvc/pom.xml b/graphql/boot-graphql-webmvc/pom.xml
index fc83055c1..9e72b417c 100644
--- a/graphql/boot-graphql-webmvc/pom.xml
+++ b/graphql/boot-graphql-webmvc/pom.xml
@@ -6,7 +6,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.2.0-M3
+ 3.2.0-RC2
com.example.graphql
@@ -19,7 +19,7 @@
UTF-8
UTF-8
- 17
+ 21
2.2.0
1.1.0
1.5.5.Final
diff --git a/graphql/boot-graphql-webmvc/src/main/java/com/example/graphql/services/PostCommentService.java b/graphql/boot-graphql-webmvc/src/main/java/com/example/graphql/services/PostCommentService.java
index da9c4af5f..17aa81ab3 100644
--- a/graphql/boot-graphql-webmvc/src/main/java/com/example/graphql/services/PostCommentService.java
+++ b/graphql/boot-graphql-webmvc/src/main/java/com/example/graphql/services/PostCommentService.java
@@ -20,7 +20,7 @@
import org.springframework.transaction.annotation.Transactional;
@Service
-@Transactional
+@Transactional(readOnly = true)
@RequiredArgsConstructor
@Loggable
public class PostCommentService {
@@ -30,7 +30,6 @@ public class PostCommentService {
private final PostCommentEntityToResponseMapper postCommentEntityToResponseMapper;
private final PostCommentRequestToEntityMapper postCommentRequestToEntityMapper;
- @Transactional(readOnly = true)
public List findAllPostComments() {
List> completableFutureList =
postCommentRepository.findAll().stream()
@@ -44,27 +43,28 @@ public List findAllPostComments() {
return completableFutureList.stream().map(CompletableFuture::join).toList();
}
- @Transactional(readOnly = true)
public Optional findPostCommentById(Long id) {
- return findCommentById(id).map(postCommentEntityToResponseMapper::convert);
+ return this.postCommentRepository
+ .findById(id)
+ .map(postCommentEntityToResponseMapper::convert);
}
- @Transactional(readOnly = true)
public Optional findCommentById(Long commentId) {
return this.postCommentRepository.findById(commentId);
}
+ @Transactional
public PostCommentResponse addCommentToPost(PostCommentRequest postCommentRequest) {
PostCommentEntity postCommentEntity =
postCommentRequestToEntityMapper.covert(postCommentRequest, postRepository);
return saveAndConvert(postCommentEntity);
}
+ @Transactional
public void deletePostCommentById(Long id) {
postCommentRepository.deleteById(id);
}
- @Transactional(readOnly = true)
public Map> getCommentsByPostIdIn(List postIds) {
return this.postCommentRepository.findByPostEntity_IdIn(postIds).stream()
.map(postCommentEntityToResponseMapper::convert)
@@ -72,6 +72,7 @@ public Map> getCommentsByPostIdIn(List pos
.collect(Collectors.groupingBy(PostCommentResponse::postId));
}
+ @Transactional
public PostCommentResponse updatePostComment(
PostCommentEntity postCommentEntity, PostCommentRequest postCommentRequest) {
postCommentEntityToResponseMapper.updatePostCommentEntity(