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:
List<Predicate> conditionsList = new ArrayList<Predicate>();
conditionsList.add(criteriaBuilder.between(inputDate, root.get("startDate"), root.get("endDate")));
I found the below solution from Using JPA/Hibernate Criteria to pull between a date:
ParameterExpression<Date> d = criteriaBuilder.parameter(Date.class);
criteriaBuilder.between(d, root.<Date>get("startDate"), root.<Date>get("endDate"));
But how to set the Parameterexpression value to inputDate variable value before adding the CriteriaBuilder to the Predicate?