From a9362002a7a6a483b69c573fb03d11cb778b3946 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 14 Oct 2017 14:59:58 +0200 Subject: [PATCH] Continued: - need to change CascadeType to ALL as this should be persisted and all others - also changed back from ALL to REFRESH as the foreign entities do already exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/branchoffice/CompanyBranchOffice.java | 2 +- .../model/department/CompanyDepartment.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java index 5db5c8d..76240d6 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java @@ -155,7 +155,7 @@ public class CompanyBranchOffice implements BranchOffice { * Opening times for this branch office */ @JoinTable (name = "branch_opening_times", joinColumns = @JoinColumn(name = "branch_opening_id", referencedColumnName = "branch_id"), inverseJoinColumns = @JoinColumn(name = "opening_branch_id", referencedColumnName = "opening_times_id")) - @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.REFRESH) + @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.ALL) private List branchOpeningTimes; /** diff --git a/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java index be6fd1d..8929753 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java @@ -70,14 +70,14 @@ public class CompanyDepartment implements Department { * Where this department is located */ @JoinColumn (name = "department_branch_id") - @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.REFRESH) private BranchOffice departmentBranchOffice; /** * Connection to company contact */ @JoinColumn (name = "department_company_id", nullable = false, updatable = false) - @ManyToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false) + @ManyToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.REFRESH, optional = false) private BusinessBasicData departmentCompany; /** @@ -92,7 +92,7 @@ public class CompanyDepartment implements Department { * Where this department is located */ @JoinColumn (name = "department_headquarters_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.REFRESH) private HeadquartersData departmentHeadquarters; /** @@ -114,7 +114,7 @@ public class CompanyDepartment implements Department { * Department lead employee */ @JoinColumn (name = "department_lead_id") - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH) private Employee departmentLead; /** -- 2.39.5