Reputation: 2348
I am using spring data cassandra
My this code is working
@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);
But when i am trying to give date as param, it is giving error
@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);
What am i missing?
notificationId column is timeuuid in DB
Upvotes: 3
Views: 3681
Reputation: 935
You can use SimpleDateFormatter then create date instance and assign that value to TimeStamp column. See mapping between Java type and CQL types.
Enjoy :)
Upvotes: 0
Reputation: 87069
the mintimeuuid
function expects timestamp as parameter, but you pass a string. You need to pass variable with java.util.Date
type instead. See the documentation for mapping between Java type and CQL types.
Upvotes: 4