]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 27 Jul 2017 20:04:23 +0000 (22:04 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 27 Jul 2017 20:04:23 +0000 (22:04 +0200)
- renamed field where an employee is a contact person within the company
- added named query to search for entities based on primary key (id)

src/org/mxchange/jcontactsbusiness/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/CompanyBasicData.java

index 525d4e12f34d883b52e13b362e5b09169e6ac0a7..49f0d8722652354ae0e602b0a7c54792fa1bf659 100644 (file)
@@ -53,14 +53,14 @@ public interface BusinessBasicData extends Serializable {
         * <p>
         * @return Company contact person
         */
-       Employee getCompanyContact ();
+       Employee getCompanyContactEmployee ();
 
        /**
         * Setter for company contact person
         * <p>
         * @param companyContact Company contact person
         */
-       void setCompanyContact (final Employee companyContact);
+       void setCompanyContactEmployee (final Employee companyContact);
 
        /**
         * Getter for business contact id
index 7282d1fde700e160425bb5bddc078eed4b9e400e..5386d72672c62728aafb83c7326bb7af2b1f6876 100644 (file)
@@ -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;