* <p>
* @return Branches list
*/
- List<BranchOffice> getBranches ();
+ List<BranchOffice> getBrancheOffices ();
/**
* Setter for branches list
* <p>
* @param branches Branches list
*/
- void setBranches (final List<BranchOffice> branches);
+ void setBrancheOffices (final List<BranchOffice> branches);
/**
* Getter for company contact person
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;
private BusinessBasicData basicBusinessData;
/**
- * Reference to employee branches
+ * Reference to company branch offfices
*/
- @JoinColumn (name = "company_branches_id", nullable = false, updatable = false)
- @OneToMany (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
- private List<BranchOffice> branches;
+ @Transient
+ private List<BranchOffice> brancheOffices;
/**
* Reference to contact person
}
@Override
- public List<BranchOffice> getBranches () {
- return this.branches;
+ public List<BranchOffice> getBrancheOffices () {
+ return this.brancheOffices;
}
@Override
- public void setBranches (final List<BranchOffice> branches) {
- this.branches = branches;
+ public void setBrancheOffices (final List<BranchOffice> brancheOffices) {
+ this.brancheOffices = brancheOffices;
}
@Override
/**
* Company's main phone number: +ccxxxxxxxxxx
*/
- @JoinColumn (name = "company_phone_number")
+ @JoinColumn (name = "company_phone_number_id")
@OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private DialableLandLineNumber companyPhoneNumber;
void setBranchId (final Long branchId);
/**
- * Getter for branch office's country code
+ * Getter for branch office's country
* <p>
- * @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
* <p>
- * @param branchCountryCode Branch office's country code
+ * @param branchCountryCode Branch office's country
*/
void setBranchCountry (final Country branchCountryCode);
+ /**
+ * Getter for branch office's company
+ * <p>
+ * @return Branch office's company
+ */
+ Long getBranchCompanyContact ();
+
+ /**
+ * Setter for branch office's company
+ * <p>
+ * @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 ();
}
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;
* <p>
* @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<BranchOffice> {
/**
@Column (name = "branch_city", length = 100, nullable = false)
private String branchCity;
+ /**
+ * Company that has this branch office
+ */
+ @JoinColumn (name = "branch_company_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = CompanyContact.class, optional = false, cascade = CascadeType.ALL)
+ private Long branchCompanyContact;
+
/**
* Branch office's country code
*/
this.branchCity = branchCity;
}
+ @Override
+ public Long getBranchCompanyContact () {
+ return this.branchCompanyContact;
+ }
+
+ @Override
+ public void setBranchCompanyContact (final Long branchCompanyContact) {
+ this.branchCompanyContact = branchCompanyContact;
+ }
+
@Override
public Country getBranchCountry () {
return this.branchCountry;