Open jalger98 opened 9 years ago
Adding a timestamp option to the BatchExecutor BatchOptions would also be helpful.
I will take a look at it
Awesome, thanks!
I was able to modify the logic of the buildDelete method in the MappingBuilder as a simple proof of the logic being there. However, your current "master" branch has 2.2.0-rc2 which does not support the format that code I'm about to suggest. It is written with the syntax for cassandra-driver-core version 2.1.3. Obviously, you'd have to update the signature to support passing in the options instead of the hardcoded version below but this seems to confirm that it could be retrofitted fairly easily.
public static <T> Delete buildDelete(EntityTypeMetadata entityMetadata, List<String> pkCols, Object[] values, String keyspace) {
String table = entityMetadata.getTableName();
Delete delete = QueryBuilder.delete().from(keyspace, table);
// Apply the timestamp here.
delete.using(timestamp(System.currentTimeMillis()*1000));
for (int i = 0; i < values.length; i++) {
delete.where(eq(pkCols.get(i), values[i]));
}
return delete;
}
There is no way to provide options to the delete methods of the MappingSession or BatchExecutor. Delete should take options like the WriteOptions supported for the save methods. We could use the timestamp and consistencyLevel options immediately. retryPolicy would be nice too.