I have two entities called EmployeeEntity
and EmployeeDeparmentEntity
.If I fetch the employee I want fetch all departments which are active.I have used bi-directional mapping for both entities.
EmployeeDeparment
@Entity
public class EmployeeDeparment implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne
@JoinColumn(name = "employeeid")
private EmployeeEntity employeeentity;
@Temporal(javax.persistence.TemporalType.DATE)
private Date addeddate;
@Temporal(javax.persistence.TemporalType.DATE)
private Date modifieddate;
@ManyToOne
private EmployeeEntity reportingTo;
@ManyToOne
private DepartmentMaster departmentID;
private boolean status;
}