From ececcd560488b9c81ec916ae79efe81b3ed639ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 16 Nov 2017 23:16:45 +0100 Subject: [PATCH] Continued: - need to only refresh other entity - no need to be over-happy with checking references, else endless loops may occur ... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/basicdata/BusinessBasicData.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java index 43be826..44b9ced 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java @@ -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; } -- 2.39.5