diff --git a/src/main/java/org/springframework/data/cassandra/util/CqlUtils.java b/src/main/java/org/springframework/data/cassandra/util/CqlUtils.java index 1b21cccf6..90cfe1610 100644 --- a/src/main/java/org/springframework/data/cassandra/util/CqlUtils.java +++ b/src/main/java/org/springframework/data/cassandra/util/CqlUtils.java @@ -357,11 +357,9 @@ public abstract class CqlUtils { */ final Batch b = QueryBuilder.batch(); - List queries = new ArrayList(); - for (final T objectToSave : objectsToSave) { - queries.add(toUpdateQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); + b.add((Statement) toUpdateQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); } @@ -393,21 +391,12 @@ public abstract class CqlUtils { */ final Batch b = QueryBuilder.batch(); - List queries = new ArrayList(); - for (final T objectToSave : objectsToSave) { - queries.add(toInsertQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); + b.add((Statement) toInsertQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); } - /* - * Add all the Queries to the batch - */ - for (Query query : queries) { - b.add((Statement) query); - } - addQueryOptions(b, optionsByName); return b; @@ -522,11 +511,9 @@ public abstract class CqlUtils { */ final Batch b = QueryBuilder.batch(); - List queries = new ArrayList(); - for (final T objectToSave : entities) { - queries.add(toDeleteQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); + b.add((Statement) toDeleteQuery(keyspaceName, tableName, objectToSave, entity, optionsByName)); }