From: Roland Häder Date: Sat, 14 Oct 2017 12:59:58 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a9362002a7a6a483b69c573fb03d11cb778b3946;p=jcontacts-business-core.git 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 Signed-off-by: Roland Häder --- 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; /**