From 35ddf85269eda9d5e1f1fb277a33af195a1ce425 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 14 Jan 2025 15:44:44 +0100 Subject: [PATCH] use reload where possible --- .../hsadminng/hs/office/debitor/HsOfficeDebitorController.java | 2 +- .../hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java | 2 +- .../office/debitor/HsOfficeDebitorControllerAcceptanceTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java index 0ac686ee..78b8082d 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java @@ -179,7 +179,7 @@ public class HsOfficeDebitorController implements HsOfficeDebitorsApi { context.define(currentSubject, assumedRoles); - final var current = debitorRepo.findByUuid(debitorUuid).orElseThrow().load(); + final var current = debitorRepo.findByUuid(debitorUuid).orElseThrow().reload(em); new HsOfficeDebitorEntityPatcher(em, current).apply(body); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java index b27f1866..374e2939 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java @@ -89,7 +89,7 @@ public class HsOfficeDebitorEntity implements BaseEntity, SELECT DISTINCT partner.uuid FROM hs_office.partner partner JOIN hs_office.relation dRel - ON dRel.uuid = debitorreluuid AND dRel.type = 'DEBITOR' + ON dRel.uuid = debitorRelUuid AND dRel.type = 'DEBITOR' JOIN hs_office.relation pRel ON pRel.uuid = partner.partnerRelUuid AND pRel.type = 'PARTNER' WHERE pRel.holderUuid = dRel.anchorUuid diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java index 9d0425c4..84d6b280 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java @@ -803,7 +803,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu .vatReverseCharge(false) .build(); - return debitorRepo.save(newDebitor).load(); + return debitorRepo.save(newDebitor).reload(em); }).assertSuccessful().returnedValue(); }