public CommonResponseModel getLeaveHistory(HttpHeaders httpHeaders) {
EntityManager manager = DBManager.getDBManager();
int empId = Integer.parseInt(httpHeaders.getHeaderString(AppConstants.Headers.EMP_ID));
StoredProcedureQuery appliedhistory = manager.createStoredProcedureQuery("leave_applied_history_SP",
"appliedhistory");
appliedhistory.registerStoredProcedureParameter("employeeid", Integer.class, ParameterMode.IN);
StoredProcedureQuery historyleavehistory = manager.createStoredProcedureQuery("Leave_history_SP",
"historyleavehistory");
StoredProcedureQuery mangerquery = manager.createStoredProcedureQuery("testformanger", "manger");
mangerquery.registerStoredProcedureParameter("employeeid", Integer.class, ParameterMode.IN);
historyleavehistory.registerStoredProcedureParameter("employeeid", Integer.class, ParameterMode.IN);
appliedhistory.setParameter("employeeid", 845);
historyleavehistory.setParameter("employeeid", 845);
mangerquery.setParameter("employeeid", 845);
List<AppliedLeaveHistoryModel> appliedleavehistory = appliedhistory.getResultList();
AppliedLeaveHistoryModel applied = new AppliedLeaveHistoryModel();
List<Managers> mangerlist = mangerquery.getResultList();
List<HistoryLeaveHistoryModel> hitoryleavehistory = historyleavehistory.getResultList();
applied.setManager(mangerlist);
LeaveHistoryResponseWrapper model = new LeaveHistoryResponseWrapper();
LeaveHistoryData leavehistorydata = new LeaveHistoryData();
leavehistorydata.setApplied(appliedleavehistory);
leavehistorydata.setHistory(hitoryleavehistory);
model.setData(leavehistorydata);
return model;
}
this is my Datamodel:
public class AppliedLeaveHistoryModel {
int leaveId;
String type;
Date appliedOn;
String dates;
String reason;
int days;
int approvalStatus;
List<Managers> manager;
public List<Managers> getManager() {
return manager;
}
public void setManager(List<Managers> manager) {
this.manager = manager;
}
public AppliedLeaveHistoryModel() {
// TODO Auto-generated constructor stub
}
public AppliedLeaveHistoryModel(int leaveId, String type, Date appliedOn, String dates, String reason, int days,
int approvalStatus) {
this.leaveId = leaveId;
this.type = type;
this.appliedOn = appliedOn;
this.dates = dates;
this.reason = reason;
this.days = days;
this.approvalStatus = approvalStatus;
}
public int getLeaveId() {
return leaveId;
}
public void setLeaveId(int leaveId) {
this.leaveId = leaveId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getAppliedOn() {
return appliedOn;
}
public void setAppliedOn(Date appliedOn) {
this.appliedOn = appliedOn;
}
public String getDates() {
return dates;
}
public void setDates(String dates) {
this.dates = dates;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
public int getApprovalStatus() {
return approvalStatus;
}
public void setApprovalStatus(int approvalStatus) {
this.approvalStatus = approvalStatus;
}
}
I am getting Data from List listmanger and I have created AppliedLeaveHistoryModel object and am able to set object.setManger(listmanger) but when I debug and check the value of List appliedleavehistory = appliedhistory.getResultList(); in this object I am unable to set that value. Please help me where am doing wrong .