diff --git a/spring-cassandra/src/main/java/org/springframework/cassandra/core/cql/generator/CreateKeyspaceCqlGenerator.java b/spring-cassandra/src/main/java/org/springframework/cassandra/core/cql/generator/CreateKeyspaceCqlGenerator.java index d0aa5c22b..27543b8cc 100644 --- a/spring-cassandra/src/main/java/org/springframework/cassandra/core/cql/generator/CreateKeyspaceCqlGenerator.java +++ b/spring-cassandra/src/main/java/org/springframework/cassandra/core/cql/generator/CreateKeyspaceCqlGenerator.java @@ -19,7 +19,9 @@ import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull; import java.util.Map; +import org.springframework.cassandra.config.KeyspaceAttributes; import org.springframework.cassandra.core.keyspace.CreateKeyspaceSpecification; +import org.springframework.cassandra.core.keyspace.KeyspaceOption; import org.springframework.cassandra.core.keyspace.Option; /** @@ -60,6 +62,17 @@ public class CreateKeyspaceCqlGenerator extends KeyspaceCqlGenerator options = spec().getOptions(); + Object replicationOption = options.get(KeyspaceOption.REPLICATION.getName()); + if (replicationOption == null) { + Map simpleReplicationMap = KeyspaceAttributes.newSimpleReplication(); + spec().with(KeyspaceOption.REPLICATION, simpleReplicationMap); + } + + Object durableWrites = options.get(KeyspaceOption.DURABLE_WRITES.getName()); + if (durableWrites == null) { + spec().with(KeyspaceOption.DURABLE_WRITES, Boolean.TRUE); + } + if (!options.isEmpty()) { // option preamble