I want to get value from the database, in my case I use List to get the value from the database but I got this error
ex = (java.lang.ClassCastException) java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.gates.cloud.model.StaffAttendanceTemp
This is my list :
List<StaffAttendanceTemp> attendanceTempList = ds.doQuery("SELECT distinct a.staf.stafPK.kod, a.attendancedate FROM StaffAttendanceTemp a"
+ " WHERE a.staf.stafPK.companyid = :companyid")
.setParameter("companyid", this.getSession().getCompanyid()).getResultList();
System.out.println(attendanceTempList.getClass().getSimpleName());
List<StaffAttendanceTemp> attendanceTempList2 = ds.doQuery("SELECT a FROM StaffAttendanceTemp a"
+ " WHERE a.staf.stafPK.companyid = :companyid")
.setParameter("companyid", this.getSession().getCompanyid()).getResultList();
System.out.println(attendanceTempList2.getClass().getSimpleName());
and this is my loop
for (StaffAttendanceTemp attendanceTemprecursive : attendanceTempList) {
Date timePunchin = null;
Date timeBreakout = null;
Date timeBreakin = null;
Date timePunchout = null;
Date tarikhPunch = null;
for (StaffAttendanceTemp attendanceTemp2recursive : attendanceTempList2) {
}
}
how to solve this?