2
votes

I'm using the Spring Data Cassandra in my project, i need to save a date value in the Cassandra table, the column type is Date in DB, i can save the value in it, but i can't set it back to null. When i was calling the

CrudRepository ->save(obj)

, the data in the field was not removed. I tried to set the date field in the bean to null, then call the save method, it not work.

I'm wondering how can i save the date value back to null?

Anyone please help.

Thanks.


The cassandra can support insert many times for the same record. So I just call the same method for both create and update. If i use the cassandra api, to create a BoundStatement, use the SQL "insert into xxxx(a,b) value(?,?);" i can insert the null value to the table successfully. But if i call the repository's save() method, the date value will be the same as before.

1
Can you please paste the code too? Are you using any annotations? - Punter Vicky
No other annotation, just a @Repository on the XXXRepo interface. The problem is if i use driver api it works, and if i use the SpringData Cassandra's repo, it not works. - user2857793

1 Answers

0
votes

If date is primary key then you can't save . if date is not primary key then you can delete date column .