I would like to compare a date to a timestamp in the database. I currently use
predicates.add(criteriaBuilder.between(eventRoot.<Date>get("time"), dBegin, dEnd));
- dBegin = Thu Feb 04 00:00:00
- dEnd = Thu Feb 04 23:59:59
eventRoot
private Date time;
I also tried formatting the date with the following format, to no success.
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
And changing
predicates.add(criteriaBuilder.equal(eventRoot.<String>get("time"), curDformat));
where curDformat is the formatted date to
2025-08-05
And changing the type to String in my eventRoot.
How would I go about only checking the date with the database? And would this improve performance or is it fine doing it with between?