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) {