From: Roland Häder Date: Thu, 27 Jul 2017 20:04:23 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3b1679e910d6e145e3e8999042cc4a758991ba7f;p=jcontacts-business-core.git Continued: - renamed field where an employee is a contact person within the company - added named query to search for entities based on primary key (id) --- diff --git a/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java index 525d4e1..49f0d87 100644 --- a/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java @@ -53,14 +53,14 @@ public interface BusinessBasicData extends Serializable { *

* @return Company contact person */ - Employee getCompanyContact (); + Employee getCompanyContactEmployee (); /** * Setter for company contact person *

* @param companyContact Company contact person */ - void setCompanyContact (final Employee companyContact); + void setCompanyContactEmployee (final Employee companyContact); /** * Getter for business contact id diff --git a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java index 7282d1f..5386d72 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java @@ -58,7 +58,8 @@ import org.mxchange.jusercore.model.user.User; @Table (name = "company_basic_data") @NamedQueries ( { - @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.businessDataId") + @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.businessDataId"), + @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.businessDataId = :businessDataId") } ) @SuppressWarnings ("PersistenceUnitPresent") @@ -94,9 +95,9 @@ public class CompanyBasicData implements BusinessBasicData { /** * Reference to contact person */ - @JoinColumn (name = "company_contact_id") + @JoinColumn (name = "company_contact_employee_id") @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) - private Employee companyContact; + private Employee companyContactEmployee; /** * Company's main email address (example: info@company.com) @@ -197,7 +198,7 @@ public class CompanyBasicData implements BusinessBasicData { return false; } else if (!Objects.equals(this.getHeadQuartersData(), other.getHeadQuartersData())) { return false; - } else if (!Objects.equals(this.getCompanyContact(), other.getCompanyContact())) { + } else if (!Objects.equals(this.getCompanyContactEmployee(), other.getCompanyContactEmployee())) { return false; } else if (!Objects.equals(this.getCompanyFounder(), other.getCompanyFounder())) { return false; @@ -239,13 +240,13 @@ public class CompanyBasicData implements BusinessBasicData { } @Override - public Employee getCompanyContact () { - return this.companyContact; + public Employee getCompanyContactEmployee () { + return this.companyContactEmployee; } @Override - public void setCompanyContact (final Employee companyContact) { - this.companyContact = companyContact; + public void setCompanyContactEmployee (final Employee companyContactEmployee) { + this.companyContactEmployee = companyContactEmployee; } @Override @@ -378,7 +379,7 @@ public class CompanyBasicData implements BusinessBasicData { hash = 37 * hash + Objects.hashCode(this.getCompanyName()); hash = 37 * hash + Objects.hashCode(this.getCompanyLegalStatus()); hash = 37 * hash + Objects.hashCode(this.getHeadQuartersData()); - hash = 37 * hash + Objects.hashCode(this.getCompanyContact()); + hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee()); hash = 37 * hash + Objects.hashCode(this.getCompanyFounder()); return hash;