From: Roland Haeder Date: Sat, 10 Oct 2015 21:29:09 +0000 (+0200) Subject: added cascade type ALL where applyable X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bf6a696d5924ddd9c376f9024fe8884c47d6c5ab;p=jcontacts-business-core.git added cascade type ALL where applyable --- diff --git a/src/org/mxchange/jcontactsbusiness/CompanyContact.java b/src/org/mxchange/jcontactsbusiness/CompanyContact.java index ea8e6f3..faad992 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyContact.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyContact.java @@ -17,6 +17,7 @@ package org.mxchange.jcontactsbusiness; import java.util.List; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -53,14 +54,14 @@ public class CompanyContact implements BusinessContact, Comparable branches; /** @@ -74,22 +75,22 @@ public class CompanyContact implements BusinessContact, Comparable employees; /** * Reference to headquarters data */ @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyHeadQuartersData.class, optional = false) + @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL, optional = false) private HeadQuartersData headQuartersData; @Override diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java index a816142..67676ea 100644 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -18,6 +18,7 @@ package org.mxchange.jcontactsbusiness.basicdata; import java.util.List; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -75,7 +76,7 @@ public class CompanyBasicData implements BusinessBasicData, Comparable companyPhoneNumber; /** * Company's main fax numbers: +ccxxxxxxxxxx */ @JoinColumn (name = "company_fax_number_id") - @OneToMany(targetEntity = FaxNumber.class) + @OneToMany (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) private List companyFaxNumberList; /** diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java index 236e03c..76b28d6 100644 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java @@ -50,7 +50,7 @@ public class CompanyDepartment implements Department, Comparable { * Connection to company contact */ @JoinColumn (name = "department_company_id", nullable = false, updatable = false) - @ManyToOne (targetEntity = CompanyContact.class, optional = false) + @ManyToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false) private BusinessContact departmentCompany; /** diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index 846257e..31df0b1 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -61,14 +61,14 @@ public class CompanyEmployee implements Employee, Comparable { * Branch office the employee works at */ @JoinColumn (name = "employee_branch_id") - @OneToOne (targetEntity = CompanyBranchOffice.class, orphanRemoval = true) + @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL, orphanRemoval = true) private BranchOffice employeeBranchOffice; /** * Department the employee works at */ @JoinColumn (name = "employee_department_id", nullable = false) - @OneToOne (targetEntity = CompanyDepartment.class, optional = false) + @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL, optional = false) private Department employeeDepartment; /** @@ -81,7 +81,7 @@ public class CompanyEmployee implements Employee, Comparable { * Employee's business mobile number */ @JoinColumn (name = "employee_mobile_number_id") - @OneToOne(targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL) private DialableCellphoneNumber employeeMobileNumber; /** @@ -95,7 +95,7 @@ public class CompanyEmployee implements Employee, Comparable { * Employee's personal data */ @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false) - @OneToOne (targetEntity = UserContact.class, optional = false) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) private Contact employeePersonalData; /**