From aeb4fe20383d05538b2814d0dc9831eded7b4a59 Mon Sep 17 00:00:00 2001 From: Dominic West Date: Fri, 4 Aug 2023 14:22:00 +0100 Subject: [PATCH] Making migrateUser function transactional --- .../cabinetoffice/gap/adminbackend/services/UserService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/services/UserService.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/services/UserService.java index eef3674b..1b96e2fd 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/services/UserService.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/services/UserService.java @@ -4,6 +4,7 @@ import gov.cabinetoffice.gap.adminbackend.repositories.GrantApplicantRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.UUID; @@ -15,6 +16,7 @@ public class UserService { private final GrantApplicantRepository grantApplicantRepository; + @Transactional public void migrateUser(final String oneLoginSub, final UUID colaSub) { gapUserRepository.findByUserSub(colaSub.toString()).ifPresent(gapUser -> { gapUser.setUserSub(oneLoginSub);