Spring Data JPA确定重叠日期范围

时间:2015-09-16 19:12:43

标签: spring-data-jpa

我是Spring Data Jpa的新手

我有以下对象

public class VehicleDetail {
    private long vehicleDetailId;

    @OneToMany(mappedBy = "vehicleDetail")
    private List<NonAvailabilityStatus> nonAvailabilityStatus = new ArrayList<NonAvailabilityStatus>();
}

public class NonAvailabilityStatus{

    private long nonAvailabilityStatusId;

    @Column(name="START_DT_TM")
    private Date nonAvailabiltyStartDateTime;

    @Column(name="END_DT_TM")
    private Date nonAvailabiltyEndDateTime;
}

我想使用方法名称查询检查当前日期和当前日期+ 1是否在nonAvailabiltyStartDateTimenonAvailabiltyEndDateTime之间重叠。我试过了findByNonAvailabilityStatusNonAvailabiltyStartDateTimeIsBeforeAndNonAvailabilityStatusNonAvailabiltyEndDateTimeAfter(Date startDate, Date endDate),但它没有用。

0 个答案:

没有答案