From 149369f8982bdec04154cc2e22b15f5e76ba36c9 Mon Sep 17 00:00:00 2001 From: Zena0128 <0128ja@gmail.com> Date: Tue, 20 Feb 2024 18:04:53 +0900 Subject: [PATCH] =?UTF-8?q?:zap:Feat:=20=EB=A9=94=EC=9D=B8=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=84=9C=EB=B9=84=EC=8A=A4=EB=8B=A8?= =?UTF-8?q?=EC=97=90=20@Transactional=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mainpage/service/CategoryServiceImpl.java | 5 ++++- .../timetris/domain/mainpage/service/DoServiceImpl.java | 2 ++ .../domain/mainpage/service/MainPageServiceImpl.java | 3 +++ .../timetris/domain/mainpage/service/PlanServiceImpl.java | 2 ++ .../timetris/domain/mainpage/service/SeeServiceImpl.java | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/service/CategoryServiceImpl.java b/src/main/java/com/trendithon/timetris/domain/mainpage/service/CategoryServiceImpl.java index 95a3806..7b85f93 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/service/CategoryServiceImpl.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/service/CategoryServiceImpl.java @@ -12,17 +12,20 @@ import com.trendithon.timetris.global.exception.enums.ErrorStatus; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @RequiredArgsConstructor +@Transactional public class CategoryServiceImpl implements CategoryService{ private final CategoryRepository categoryRepository; private final UserRepository userRepository; -// @Override + @Override + @Transactional(readOnly = true) public List readCategoryAll(long userId) { User user = userRepository.findById(userId) .orElseThrow(() -> new CustomException(ErrorStatus.USER_NOT_FOUND_ERROR)); diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/service/DoServiceImpl.java b/src/main/java/com/trendithon/timetris/domain/mainpage/service/DoServiceImpl.java index 9c86c2b..7280f1a 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/service/DoServiceImpl.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/service/DoServiceImpl.java @@ -16,6 +16,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalTime; @@ -23,6 +24,7 @@ @Service @RequiredArgsConstructor +@Transactional public class DoServiceImpl implements DoService{ private final DoRepository doRepository; diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/service/MainPageServiceImpl.java b/src/main/java/com/trendithon/timetris/domain/mainpage/service/MainPageServiceImpl.java index 961a216..f543b1d 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/service/MainPageServiceImpl.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/service/MainPageServiceImpl.java @@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.util.List; @@ -20,6 +21,7 @@ @Service @RequiredArgsConstructor +@Transactional(readOnly = true) public class MainPageServiceImpl implements MainPageService{ private final PlanRepository planRepository; @@ -61,6 +63,7 @@ public MyPageResponse.getMyPageDTO getUserInfo(Long userId) { @Override @Scheduled(cron = "0 0 0 * * *") + @Transactional public void createUserDate() { List users = userRepository.findAll(); LocalDate localDate = LocalDate.now(); diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/service/PlanServiceImpl.java b/src/main/java/com/trendithon/timetris/domain/mainpage/service/PlanServiceImpl.java index a9c5bc2..2d7bb60 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/service/PlanServiceImpl.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/service/PlanServiceImpl.java @@ -15,12 +15,14 @@ import com.trendithon.timetris.global.exception.enums.ErrorStatus; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalTime; @Service @RequiredArgsConstructor +@Transactional public class PlanServiceImpl implements PlanService { private final PlanRepository planRepository; diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/service/SeeServiceImpl.java b/src/main/java/com/trendithon/timetris/domain/mainpage/service/SeeServiceImpl.java index 9947316..6c532d4 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/service/SeeServiceImpl.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/service/SeeServiceImpl.java @@ -16,11 +16,13 @@ import com.trendithon.timetris.global.exception.enums.ErrorStatus; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; @Service @RequiredArgsConstructor +@Transactional public class SeeServiceImpl implements SeeService{ private final SeeRepository seeRepository;