import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
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 javax.persistence.Transient;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountryData;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
* Branch office's country code
*/
@JoinColumn (name = "branch_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
- @Transient
- private Country branchCountry;
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+ private transient Country branchCountry;
/**
* Branch office's main email address (example: branch-name@company.com)
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
-import javax.persistence.Transient;
import org.mxchange.jcontactsbusiness.BusinessContact;
import org.mxchange.jcontactsbusiness.CompanyContact;
import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
* Connection to company contact
*/
@JoinColumn (name = "department_company_id", nullable = false, updatable = false)
- @ManyToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false)
- @Transient
- private BusinessContact departmentCompany;
+ @ManyToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+ private transient BusinessContact departmentCompany;
/**
* Id number
* Department lead employee
*/
@JoinColumn (name = "department_lead_id", nullable = false)
- @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
- @Transient
- private Employee departmentLead;
+ @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private transient Employee departmentLead;
/**
* Department name
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
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 javax.persistence.Transient;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.UserContact;
import org.mxchange.jcontactsbusiness.branch.BranchOffice;
* Employee's personal data
*/
@JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false)
- @Transient
- private Contact employeePersonalData;
+ @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+ private transient Contact employeePersonalData;
/**
* Employee's phone extension (or number if different)
* Employee's position (example: CEO)
*/
@JoinColumn (name = "employee_position_id")
- @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL)
- @Transient
- private JobPosition employeePosition;
+ @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private transient JobPosition employeePosition;
@Override
public int compareTo (final Employee employee) {
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
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 javax.persistence.Transient;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountryData;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
* Headquarter's country code
*/
@JoinColumn (name = "headquarters_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
- @Transient
- private Country headquartersCountry;
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+ private transient Country headquartersCountry;
/**
* Headquarters' fax number