]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Nov 2017 22:16:45 +0000 (23:16 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Nov 2017 22:21:40 +0000 (23:21 +0100)
- need to only refresh other entity
- no need to be over-happy with checking references, else endless loops may
  occur ...

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java

index 43be8263714aefc4882b9dc2f04e62ed07761c68..44b9ced39117a58e7bd7e9198ddf38723a2dcd0c 100644 (file)
@@ -95,7 +95,7 @@ public class BusinessBasicData implements BasicData {
         * Reference to contact person
         */
        @JoinColumn (name = "company_contact_employee_id")
-       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.ALL)
+       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH)
        private Employable companyContactEmployee;
 
        /**
@@ -123,14 +123,14 @@ public class BusinessBasicData implements BasicData {
         * Reference to CEO "employee"
         */
        @JoinColumn (name = "company_founder_id")
-       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.ALL)
+       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH)
        private Employable companyFounder;
 
        /**
         * Reference to headquarter data
         */
        @JoinColumn (name = "company_headquarter_data_id")
-       @OneToOne (targetEntity = BusinessHeadquarter.class, cascade = CascadeType.ALL)
+       @OneToOne (targetEntity = BusinessHeadquarter.class, cascade = CascadeType.REFRESH)
        private Headquarter companyHeadquarterData;
 
        /**
@@ -144,7 +144,7 @@ public class BusinessBasicData implements BasicData {
         * Id number of company logo
         */
        @JoinColumn (name = "company_logo_id")
-       @OneToOne (targetEntity = BusinessLogo.class, cascade = CascadeType.ALL)
+       @OneToOne (targetEntity = BusinessLogo.class, cascade = CascadeType.REFRESH)
        private Logo companyLogo;
 
        /**
@@ -212,12 +212,6 @@ public class BusinessBasicData implements BasicData {
                        return false;
                } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) {
                        return false;
-               } else if (!Objects.equals(this.getCompanyHeadquarterData(), other.getCompanyHeadquarterData())) {
-                       return false;
-               } else if (!Objects.equals(this.getCompanyContactEmployee(), other.getCompanyContactEmployee())) {
-                       return false;
-               } else if (!Objects.equals(this.getCompanyFounder(), other.getCompanyFounder())) {
-                       return false;
                }
 
                return true;
@@ -383,9 +377,6 @@ public class BusinessBasicData implements BasicData {
 
                hash = 37 * hash + Objects.hashCode(this.getBasicDataId());
                hash = 37 * hash + Objects.hashCode(this.getCompanyName());
-               hash = 37 * hash + Objects.hashCode(this.getCompanyHeadquarterData());
-               hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee());
-               hash = 37 * hash + Objects.hashCode(this.getCompanyFounder());
 
                return hash;
        }