我正在使用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
答案 0 :(得分:3)
mintimeuuid
函数期望将时间戳作为参数,但是您传递了一个字符串。您需要改为传递java.util.Date
类型的变量。参见documentation for mapping between Java type and CQL types。