From 4de19580a5925e7d6038037eb031c2f72dedfba4 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 21 Oct 2015 11:32:20 +0200 Subject: [PATCH] =?utf8?q?A=20@OneToMany=20annotation=20always=20causes=20?= =?utf8?q?that=20in=20the=20target=20entity's=20table=20the=20column=20is?= =?utf8?q?=20being=20created.=20But=20here=20it=20is=20only=20wanted=20to?= =?utf8?q?=20have=20all=20branch=20offices=20of=20the=20company.=20Signed-?= =?utf8?q?off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jcontactsbusiness/BusinessContact.java | 4 +-- .../jcontactsbusiness/CompanyContact.java | 17 ++++++------ .../basicdata/CompanyBasicData.java | 2 +- .../branch/BranchOffice.java | 26 ++++++++++++++----- .../branch/CompanyBranchOffice.java | 22 ++++++++++++++-- 5 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/BusinessContact.java b/src/org/mxchange/jcontactsbusiness/BusinessContact.java index 277439f..ca70aa5 100644 --- a/src/org/mxchange/jcontactsbusiness/BusinessContact.java +++ b/src/org/mxchange/jcontactsbusiness/BusinessContact.java @@ -49,14 +49,14 @@ public interface BusinessContact extends Serializable { *

* @return Branches list */ - List getBranches (); + List getBrancheOffices (); /** * Setter for branches list *

* @param branches Branches list */ - void setBranches (final List branches); + void setBrancheOffices (final List branches); /** * Getter for company contact person diff --git a/src/org/mxchange/jcontactsbusiness/CompanyContact.java b/src/org/mxchange/jcontactsbusiness/CompanyContact.java index 57142c5..c36f200 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyContact.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyContact.java @@ -28,10 +28,10 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; +import javax.persistence.Transient; import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; import org.mxchange.jcontactsbusiness.branch.BranchOffice; -import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; import org.mxchange.jcontactsbusiness.employee.Employee; import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; @@ -59,11 +59,10 @@ public class CompanyContact implements BusinessContact, Comparable branches; + @Transient + private List brancheOffices; /** * Reference to contact person @@ -130,13 +129,13 @@ public class CompanyContact implements BusinessContact, Comparable getBranches () { - return this.branches; + public List getBrancheOffices () { + return this.brancheOffices; } @Override - public void setBranches (final List branches) { - this.branches = branches; + public void setBrancheOffices (final List brancheOffices) { + this.brancheOffices = brancheOffices; } @Override diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java index c44743e..9ca5b88 100644 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -102,7 +102,7 @@ public class CompanyBasicData implements BusinessBasicData, Comparable - * @return Branch office's country code + * @return Branch office's country */ Country getBranchCountry (); /** - * Setter for branch office's country code + * Setter for branch office's country *

- * @param branchCountryCode Branch office's country code + * @param branchCountryCode Branch office's country */ void setBranchCountry (final Country branchCountryCode); + /** + * Getter for branch office's company + *

+ * @return Branch office's company + */ + Long getBranchCompanyContact (); + + /** + * Setter for branch office's company + *

+ * @param branchCompanyContact Branch office's company + */ + void setBranchCompanyContact (final Long branchCompanyContact); + @Override - boolean equals (final Object object); + boolean equals (final Object object); @Override - int hashCode (); + int hashCode (); } diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index 0826881..31a5949 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -28,6 +28,7 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; +import org.mxchange.jcontactsbusiness.CompanyContact; import org.mxchange.jcountry.data.Country; import org.mxchange.jcountry.data.CountryData; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; @@ -40,8 +41,8 @@ import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; *

* @author Roland Haeder */ -@Entity (name = "company_branches") -@Table (name = "company_branches") +@Entity (name = "company_branch_offices") +@Table (name = "company_branch_offices") public class CompanyBranchOffice implements BranchOffice, Comparable { /** @@ -56,6 +57,13 @@ public class CompanyBranchOffice implements BranchOffice, Comparable