From d7545f408129fce302bbfeefecf4a41797563ccb Mon Sep 17 00:00:00 2001 From: WilliamSESE <87509674+WilliamSESE@users.noreply.github.com> Date: Mon, 16 Aug 2021 14:59:44 +0800 Subject: [PATCH] Update StatusUpdateService.java Hi, I found that there may be some minor improvements about annotations in your code. By adding @Transactional at the class level, many important aspects such as transaction propagation can be handled automatically. It can wrap your service in a generated proxy that joins an active transaction or starts a new one and commits or rolls the transaction back after your methods got executed. Based on the advantages mentioned above, I recommend that you add the @Transactional annotation at the class level. Hope my suggestions are useful! --- .../java/com/caveofprogramming/service/StatusUpdateService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-tutorial-registration-form/src/main/java/com/caveofprogramming/service/StatusUpdateService.java b/spring-boot-tutorial-registration-form/src/main/java/com/caveofprogramming/service/StatusUpdateService.java index 2c0b23a..c1290b2 100644 --- a/spring-boot-tutorial-registration-form/src/main/java/com/caveofprogramming/service/StatusUpdateService.java +++ b/spring-boot-tutorial-registration-form/src/main/java/com/caveofprogramming/service/StatusUpdateService.java @@ -5,11 +5,13 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.caveofprogramming.model.StatusUpdate; import com.caveofprogramming.model.StatusUpdateDao; @Service +@Transactional public class StatusUpdateService { private final static int PAGESIZE = 10;