ObjectDB ObjectDB

Using date in where clause

#1

I am trying to build a SELECT query as follows.

SELECT p FROM Persons p WHERE creationDate="07-25-2013"

Here I have created Persons object as java.sql.Date attribute.

 

But in doing so I am getting following exception

Operand type mismatch for operator '=' (error 757)
(position 51) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:695)

 

Can someone provide me that way to build a query with date in where clause.

edit
delete
#2

The query is invalid because you compare a date (the creationDate field) with a string literal
("07-25-2013"). Replace the string with a date literal or a parameter.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.