I have two dates in my entity. ie.
Date startDate;
Date endDate;
How do I query so that given a date, it will return all entities where the specified date lies between startDate
and endDate
?
I already tried the following:
findByStartDateAfterAndEndDateBefore(Date givenDate);
And Spring-Data-JPA didn't like this and running into errors. There is no specific error and the repo just can't be injected to my class.
What is the correct way? I know this can be done easily wqith Hibernate criteria or with Native SQL but trying to do that in Spring JPA.
Is this a problem with the query itself or some sort of incompatibility between the Date types Spring uses?
Tried findByStartDateAfterAndEndDateBefore(Date givenDate, Date givenDate)
and that returns null however.