Fast Object Database for Java - with JPA/JDO support

Using SELECT BETWEEN with LocalDate


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:

  "SELECT e FROM Element e WHERE between CURRENT_DATE and :date",
.setParameter("date", date)

I get the following error for in IntelliJ (Type mismatch: number, date or string expected) but in the thread of 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( ~[objectdb-2.8.3_01.jar:na]
    at com.objectdb.o.JPE.d( ~[objectdb-2.8.3_01.jar:na]
    at com.objectdb.o.ERR.h( ~[objectdb-2.8.3_01.jar:na]
    at com.objectdb.o.OBC.onObjectDBError( ~[objectdb-2.8.3_01.jar:na]
    at com.objectdb.jpa.JpaQuery.getResultList( ~[objectdb-2.8.3_01.jar:na]

Is this a bug or am I doing something terribly wrong?


Thanks and regards


Thank you for this report. This may be related to the new (and not complete yet) support of local dates. We will look into it and update.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Thank you again for this report. It was indeed a new issue with local dates and BETWEEN.

Please try the fix of build 2.8.3_02.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply