]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 12:24:02 +0000 (14:24 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 12:24:02 +0000 (14:24 +0200)
- setting to much to unique was not good ... :-(
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcontactsbusiness/CompanyContact.java
src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java
src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java
src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java
src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java

index 781fd46cebdde9534b0f84f239bc11cefd50e53c..ea8e6f3cc9f7f06a2c01e46838cf7abb87352a2a 100644 (file)
@@ -52,14 +52,14 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
        /**
         * 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;
 
@@ -67,7 +67,7 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
         * 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;
 
@@ -81,14 +81,14 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
        /**
         * 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;
 
index a632344e515ce984ad5303ec4e9cda16b238f884..5d0d8b9b2bd18f83bb730fc744603c2f682f836f 100644 (file)
@@ -47,7 +47,7 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
         * 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;
 
index c0d0c9e207efc8a24abf53cca12b8bdf15c5ae79..20113d36edad7873bf5011ffad195459135de676 100644 (file)
@@ -43,7 +43,7 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
         */
        @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;
 
        /**
index c8a24ddeec1afe4f3820ce4ccd99b2743f4a53ac..236e03cd5411bad28ad5f86260e09f8bc3bccfbf 100644 (file)
@@ -17,6 +17,7 @@
 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;
@@ -24,9 +25,11 @@ import javax.persistence.GenerationType;
 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;
 
 /**
@@ -55,14 +58,14 @@ public class CompanyDepartment implements Department, Comparable<Department> {
         */
        @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;
 
        /**
index 1b96e1f4aadc78c4d9e76eed68d7682c4d8a459d..86d83d89ad1bba042456cf89f485f4bdd3c80191 100644 (file)
@@ -50,7 +50,7 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
         * 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;
 
@@ -90,7 +90,7 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        /**
         * 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;
 
index 445ea3aad8b0ea217928d451f3a32db9a40d828b..46ca20e6f28929a4c96e5447e0a3c255dfc5873a 100644 (file)
@@ -63,7 +63,7 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
         * 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;
 
index 77c32e52c72c88cf6f3902869fe6540f2777e322..4ce7ceb89bbb8e8e7896b020f2a990b96b569d82 100644 (file)
@@ -42,7 +42,7 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
         */
        @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