I am trying to query all entities whose date is between today and today + X days.
The date inside the entity is a LocalDate.
To do so I created the following query:
.createQuery( "SELECT e FROM Element e WHERE e.date between CURRENT_DATE and :date", Element.class) .setParameter("date", date) .getResultList();
I get the following error for e.date in IntelliJ (Type mismatch: number, date or string expected) but in the thread of https://www.objectdb.com/issue/2564 it is said that inside the SELECT a Date is used and not a LocalDate, so I ignored this error.
Now I tried a LocalDate, a java.sql.Data and a java.util.Data as the "date" parameter but for all three tries I get the following exception:
com.objectdb.o._PersistenceException: Operand type mismatch for operator 'between'
at com.objectdb.o._PersistenceException.a(_PersistenceException.java:45) ~[objectdb-2.8.3_01.jar:na]
at com.objectdb.o.JPE.d(JPE.java:147) ~[objectdb-2.8.3_01.jar:na]
at com.objectdb.o.ERR.h(ERR.java:56) ~[objectdb-2.8.3_01.jar:na]
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1588) ~[objectdb-2.8.3_01.jar:na]
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:733) ~[objectdb-2.8.3_01.jar:na]
Is this a bug or am I doing something terribly wrong?
Thanks and regards