例如,我有Service
实体:
@OneToMany(fetch = FetchType.EAGER, mappedBy = "service")
public List<ServiceStatus> getServiceStatuses() {
return serviceStatuses;
}
和ServiceStatus
实体:
@ManyToOne
@JoinColumn(name = "service", nullable = false)
public Service getService() {
return service;
}
@Column(name = "date", nullable = false)
@Temporal(TemporalType.DATE)
public Date getDate() {
return date;
}
现在我需要查询所有Service
对象,以便每个对象都只有介于和之间的那些ServiceStatus
对象。也就是说,如果有 10 个对象具有正确的日期,则列表将只有这 10 个对象,仅此而已。是否可以?ServiceStatus.date
date1
date2
ServiceStatus
serviceStatuses
提前致谢。