From: Roland Haeder Date: Wed, 21 Oct 2015 09:32:20 +0000 (+0200) Subject: A @OneToMany annotation always causes that in the target entity's table the column... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4de19580a5925e7d6038037eb031c2f72dedfba4;p=jcontacts-business-core.git A @OneToMany annotation always causes that in the target entity's table the column is being created. But here it is only wanted to have all branch offices of the company. Signed-off-by:Roland Häder --- 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