/**
* Reference to basic data
*/
- @JoinColumn (name = "company_basic_data_id", nullable = false, updatable = false, unique = true)
+ @JoinColumn (name = "company_basic_data_id", nullable = false, updatable = false)
@OneToOne (targetEntity = CompanyBasicData.class, optional = false)
private BusinessBasicData basicBusinessData;
/**
* Reference to employee branches
*/
- @JoinColumn (name = "company_branches_id", nullable = false, updatable = false, unique = true)
+ @JoinColumn (name = "company_branches_id", nullable = false, updatable = false)
@OneToMany (targetEntity = CompanyBranchOffice.class)
private List<BranchOffice> branches;
* Id number
*/
@Id
- @Column (name = "company_contact_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "company_contact_id", length = 20, nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
private Long companyContactId;
/**
* Reference to employee list
*/
- @JoinColumn (name = "company_employees_id", nullable = false, updatable = false, unique = true)
+ @JoinColumn (name = "company_employees_id", nullable = false, updatable = false)
@OneToMany (targetEntity = CompanyEmployee.class)
private List<Employee> employees;
/**
* Reference to headquarters data
*/
- @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false, unique = true)
+ @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false)
@OneToOne (targetEntity = CompanyHeadQuartersData.class, optional = false)
private HeadQuartersData headQuartersData;
* Id number
*/
@Id
- @Column (name = "company_basic_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "company_basic_id", length = 20, nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
private Long companyBasicId;
*/
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "branch_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "branch_id", length = 20, nullable = false, updatable = false)
private Long branchId;
/**
package org.mxchange.jcontactsbusiness.department;
import javax.persistence.Basic;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.mxchange.jcontactsbusiness.BusinessContact;
import org.mxchange.jcontactsbusiness.CompanyContact;
+import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
import org.mxchange.jcontactsbusiness.employee.Employee;
/**
*/
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "department_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "department_id", length = 20, nullable = false, updatable = false)
private Long departmentId;
/**
* Department lead employee
*/
- @Basic (optional = false)
@JoinColumn (name = "department_lead_id", nullable = false)
+ @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
private Employee departmentLead;
/**
* Id number
*/
@Id
- @Column (name = "employee_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
private Long employeeId;
/**
* Employee's personal data
*/
- @JoinColumn (name = "employee_personal_id", nullable = false, unique = true, updatable = false)
+ @JoinColumn (name = "employee_personal_id", nullable = false, updatable = false)
@OneToOne (optional = false, targetEntity = UserContact.class)
private Contact employeePersonalData;
* Id number
*/
@Id
- @Column (name = "headquarters_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
private Long headquartersId;
*/
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "logo_id", length = 20, nullable = false, unique = true, updatable = false)
+ @Column (name = "logo_id", length = 20, nullable = false, updatable = false)
private Long logoId;
@Override