package org.mxchange.jcontactsbusiness;
import java.util.List;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
* 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;
/**
/**
* 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
import java.util.List;
import javax.persistence.Basic;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**