Reputation: 119
I'm already using findAllDateBetween(startD, endD)
but I would like to know if I can include another date field to search for. Something like (is not working) findAllDate1BetweenOrDate2Between(startD, endD)
. The startD and endD are the same for Date1 and Date2. Any ideas?
This is the repository:
public interface Cert10TotalRepository extends JpaRepository<Cert10Total, Integer> {
List<Cert10Total> findByDateGermBetween(Date start, Date end);
}
I would like to add OrDatePurityBetween (Date start, Date end)
Thank you
Upvotes: 0
Views: 138
Reputation: 5786
Yes you can like this:
List<Cert10Total> findByDateGermBetweenOrDatePurityBetween(Date germStart, Date germEnd, Date purityStart, Date purityEnd);
General style is that each conjunction(between and or in your case) is appended with the param that is passed.
But in all the fairness, I think you should use a query instead as it's more readable than a such a lengthy method name and misplace param values for callers
Upvotes: 3