package org.mxchange.jcontactsbusiness.branch;
import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
/**
* A POJI for branch offices
* <p>
* @return Branch office's country code
*/
- public String getBranchCountryCode ();
+ public Country getBranchCountry ();
/**
* Setter for branch office's country code
* <p>
* @param branchCountryCode Branch office's country code
*/
- public void setBranchCountryCode (final String branchCountryCode);
+ public void setBranchCountry (final Country branchCountryCode);
}
package org.mxchange.jcontactsbusiness.branch;
import javax.persistence.Basic;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
/**
* A POJO for company branch offices
/**
* Branch office's country code
*/
- @Basic (optional = false)
- @Column (name = "branch_country_code", length = 100, nullable = false)
- private String branchCountryCode;
+ @JoinColumn (name = "branch_country_code", nullable = false)
+ @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+ private Country branchCountry;
/**
* Branch office's main phone number: +ccxxxxxxxxxx
}
@Override
- public String getBranchCountryCode () {
- return this.branchCountryCode;
+ public Country getBranchCountry () {
+ return this.branchCountry;
}
@Override
- public void setBranchCountryCode (final String branchCountryCode) {
- this.branchCountryCode = branchCountryCode;
+ public void setBranchCountry (final Country branchCountry) {
+ this.branchCountry = branchCountry;
}
@Override
package org.mxchange.jcontactsbusiness.headquarters;
import javax.persistence.Basic;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
/**
* A POJO for company headquarts data
* <p>
* @author Roland Haeder
*/
-@Entity (name = "headquarters")
-@Table (name = "headquarters")
+@Entity (name = "company_headquarters")
+@Table (name = "company_headquarters")
public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<HeadQuartersData> {
/**
/**
* Headquarter's country code
*/
- @Basic (optional = false)
- @Column (name = "headquarters_country_code", length = 2, nullable = false)
- private String headquartersCountryCode;
+ @JoinColumn (name = "headquarters_country_code", nullable = false)
+ @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+ private Country headquartersCountry;
/**
* Headquarters' house number
* Id number
*/
@Id
- @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
private Long headquartersId;
/**
}
@Override
- public String getHeadquartersCountryCode () {
- return this.headquartersCountryCode;
+ public Country getHeadquartersCountry () {
+ return this.headquartersCountry;
}
@Override
- public void setHeadquartersCountryCode (final String headquartersCountryCode) {
- this.headquartersCountryCode = headquartersCountryCode;
+ public void setHeadquartersCountry (final Country headquartersCountry) {
+ this.headquartersCountry = headquartersCountry;
}
@Override
package org.mxchange.jcontactsbusiness.headquarters;
import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
/**
* A POJI for headquarters data
* <p>
* @return Headquarters' country code
*/
- public String getHeadquartersCountryCode ();
+ public Country getHeadquartersCountry ();
/**
* Setter for headquarters' country code
* <p>
* @param headquartersCountryCode Headquarters' country code
*/
- public void setHeadquartersCountryCode (final String headquartersCountryCode);
+ public void setHeadquartersCountry (final Country headquartersCountryCode);
/**
* Getter for headquarters' house number