Cassandra错误:日期的预期长度为8或0个字节

时间:2019-06-18 15:50:12

标签: cassandra spring-data-cassandra

我正在使用spring data cassandra

我的代码在起作用

@Query("SELECT count(*) as cnt FROM notifications where userid = ?0 and typeofnotification=?1  "
            + "and notificationId > minTimeuuid('2019-09-12') and category = ?3 allow filtering")

    public Integer findCountForCategoryForDate(int userId, String typeOfNotification, String category);

但是当我尝试将日期作为参数时,它给出了错误

@Query("SELECT count(*) as cnt FROM notifications where userid = ?0 and typeofnotification=?1  "
            + "and notificationId > minTimeuuid(?2) and category = ?3 allow filtering")

public Integer findCountForCategoryForDate(int userId, String typeOfNotification,String date, String category);

我想念什么?

notificationId列在数据库中是timeuuid

1 个答案:

答案 0 :(得分:3)

mintimeuuid函数期望将时间戳作为参数,但是您传递了一个字符串。您需要改为传递java.util.Date类型的变量。参见documentation for mapping between Java type and CQL types