public void call( final Throwable t ) { if ( t instanceof CollectionRuntimeException ) { CollectionRuntimeException cre = ( CollectionRuntimeException ) t; final MvccEntity mvccEntity = cre.getEntity(); final ApplicationScope scope = cre.getApplicationScope(); // one batch to handle rollback MutationBatch rollbackMb = null; final BatchStatement uniqueDeleteBatch = new BatchStatement(); final Optional<Entity> entity = mvccEntity.getEntity(); if ( entity.isPresent() ) { for ( final Field field : entity.get().getFields() ) { // if it's unique, add its deletion to the rollback batch if ( field.isUnique() ) { UniqueValue toDelete = new UniqueValueImpl( field, entity.get().getId(), mvccEntity.getVersion() ); uniqueDeleteBatch.add(uniqueValueStrat.deleteCQL(scope, toDelete )); } } // execute the batch statements for deleting unique field entries session.execute(uniqueDeleteBatch); logEntryStrat.delete( scope, entity.get().getId(), mvccEntity.getVersion() ); } } }