我有以下实体
public class Attendance extends AbstractEntity<Long>{
/**
*
*/
private static final long serialVersionUID = -1409043060497488674L;
@ManyToOne
private Student student;
@ManyToOne
private Staff staff;
@ManyToOne
private Teacher teacher;
private UserType userType;
private Timestamp checkInTime;
private String cardNumber;
@ManyToOne
private School school;
private AttendanceStatus status;
private AttendanceSource source;
@ManyToOne
private User markedBy;
@Transient
private long dummyId;
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
public UserType getUserType() {
return userType;
}
public void setUserType(UserType userType) {
this.userType = userType;
}
public Timestamp getCheckInTime() {
return checkInTime;
}
public void setCheckInTime(Timestamp checkInTime) {
this.checkInTime = checkInTime;
}
public School getSchool() {
return school;
}
public void setSchool(School school) {
this.school = school;
}
public AttendanceStatus getStatus() {
return status;
}
public void setStatus(AttendanceStatus status) {
this.status = status;
}
public User getMarkedBy() {
return markedBy;
}
public void setMarkedBy(User markedBy) {
this.markedBy = markedBy;
}
public AttendanceSource getSource() {
return source;
}
public void setSource(AttendanceSource source) {
this.source = source;
}
public long getDummyId() {
return dummyId;
}
public void setDummyId(long dummyId) {
this.dummyId = dummyId;
}
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
}
我正在尝试使用以下查询获取此表的不同行:
@Query("Select distinct a.cardNumber, a.student, a.checkInTime, a.status, a.source, a.userType from Attendance a where a.school.schoolUrl=?1 and a.userType=?2 and a.status=?3 and a.checkInTime>=?4 order by a.checkInTime desc")
List<Object[]> getTodaysStudentAttendance(String schoolUrl,UserType userType,AttendanceStatus status,Timestamp timestamp);
但无论我做什么,我都无法获取不同的行。我的数据库中有以下数据
查询返回所有这三行。我到底错过了什么?请帮忙。