]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
added cascade type ALL where applyable
authorRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 21:29:09 +0000 (23:29 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 21:50:16 +0000 (23:50 +0200)
src/org/mxchange/jcontactsbusiness/CompanyContact.java
src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java
src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java

index ea8e6f3cc9f7f06a2c01e46838cf7abb87352a2a..faad9928413dba0e9a2a3c8de684810d6eb6d11e 100644 (file)
@@ -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<BusinessConta
         * Reference to basic data
         */
        @JoinColumn (name = "company_basic_data_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = CompanyBasicData.class, optional = false)
+       @OneToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false)
        private BusinessBasicData basicBusinessData;
 
        /**
         * Reference to employee branches
         */
        @JoinColumn (name = "company_branches_id", nullable = false, updatable = false)
-       @OneToMany (targetEntity = CompanyBranchOffice.class)
+       @OneToMany (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
        private List<BranchOffice> branches;
 
        /**
@@ -74,22 +75,22 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
        /**
         * Reference to CEO "employee"
         */
-       @JoinColumn (name = "company_founder_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = CompanyEmployee.class, optional = false)
+       @JoinColumn (name = "company_founder_id")
+       @OneToOne (targetEntity = CompanyEmployee.class,cascade = CascadeType.ALL)
        private Employee companyFounder;
 
        /**
         * Reference to employee list
         */
        @JoinColumn (name = "company_employees_id", nullable = false, updatable = false)
-       @OneToMany (targetEntity = CompanyEmployee.class)
+       @OneToMany (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
        private List<Employee> 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
index a816142ef35332d944cd9e834f6e83f44c0f176d..67676ea4d0afbc73c5cc2313c2cf7b264bf7c508 100644 (file)
@@ -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<BusinessB
         * Id number of company logo
         */
        @JoinColumn (name = "company_logo_id")
-       @OneToOne (targetEntity = CompanyLogo.class, orphanRemoval = true)
+       @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL)
        private BusinessLogo companyLogo;
 
        /**
@@ -95,14 +96,14 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
         * Company's main phone number: +ccxxxxxxxxxx
         */
        @JoinColumn (name = "company_phone_number")
-       @OneToMany(targetEntity = LandLineNumber.class)
+       @OneToMany (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
        private List<DialableLandLineNumber> 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<DialableFaxNumber> companyFaxNumberList;
 
        /**
index 236e03cd5411bad28ad5f86260e09f8bc3bccfbf..76b28d695b2ad7629cd09c82a7ae35b8c34063a5 100644 (file)
@@ -50,7 +50,7 @@ public class CompanyDepartment implements Department, Comparable<Department> {
         * 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;
 
        /**
index 846257e82608e52a99990b726714fcfc7de00a78..31df0b148b209fc4082c86355d93c6dbe0d2c44b 100644 (file)
@@ -61,14 +61,14 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
         * 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> {
         * 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> {
         * 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;
 
        /**