Add CriteriaBuilder.between(Date) to Predicate?

后端 未结 3 1452
粉色の甜心
粉色の甜心 2021-01-13 23:30

I am new to JPA

I am trying to query a table where my input date value should be between the startDate and endDate of the database record

I am trying to do:<

3条回答
  •  囚心锁ツ
    2021-01-14 00:17

    Try this:

    criteriaBuilder.between(criteriaBuilder.literal(inputDate),
                            root.get("startDate"), 
                            root.get("endDate"));
    

提交回复
热议问题