1

I want to create a Query with Kundera which compares a timestamp in the where clause. My cassandra model looks like this:

CREATE TABLE booking.booking (
 id uuid,
 amount decimal,
 timestampCreate timestamp,
 timestampUpdate timestamp,
 PRIMARY KEY (id, timestampCreate)
);

I have tried with following code (using javax.persistence.criteria.CriteriaBuilder)

CriteriaBuilder criteriaBuilder = manager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = criteriaBuilder.createQuery(clazz);
Root<T> from = criteriaQuery.from(clazz);
from.alias("t");
criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.greaterThan(from.get("timestampCreate"), (Date)myDate));

My property in the class:

@Column(name="timestampcreate")
private java.util.Date timestampCreate;

But when I execute I get following error:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
at com.impetus.kundera.property.accessor.DateAccessor.toString(DateAccessor.java:166) ~[kundera-core-3.2.jar:?]

I don't know from where the String comes from, I explicit give them a Date Object. Any suggestions?

K.E.
  • 818
  • 2
  • 12
  • 28

0 Answers0