Class InsertOptions.InsertOptionsBuilder
java.lang.Object
org.springframework.data.cassandra.core.cql.QueryOptions.QueryOptionsBuilder
org.springframework.data.cassandra.core.cql.WriteOptions.WriteOptionsBuilder
org.springframework.data.cassandra.core.InsertOptions.InsertOptionsBuilder
- Enclosing class:
- InsertOptions
Builder for
InsertOptions.- Since:
- 2.0
- Author:
- Mark Paluch, Lukasz Antoniak
-
Field Summary
Fields inherited from class org.springframework.data.cassandra.core.cql.WriteOptions.WriteOptionsBuilder
timestamp, ttlFields inherited from class org.springframework.data.cassandra.core.cql.QueryOptions.QueryOptionsBuilder
consistencyLevel, executionProfileResolver, idempotent, keyspace, pageSize, routingKey, routingKeyspace, serialConsistencyLevel, timeout, tracing -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newInsertOptionswith the configured values.consistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets theConsistencyLevelto use.executionProfile(String profileName) Sets theexecution profileto use.executionProfile(ExecutionProfileResolver executionProfileResolver) Sets theExecutionProfileResolverto use.fetchSize(int fetchSize) Deprecated.idempotent(boolean idempotent) Set query execution idempotency.ifNotExists(boolean ifNotExists) Use light-weight transactions by applyingIF NOT EXISTS.keyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Sets thekeyspaceto use.pageSize(int pageSize) Sets the query fetch size forResultSetchunks.readTimeout(long readTimeout) Deprecated.readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated.routingKey(ByteBuffer routingKey) Set query routing key.routingKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace) Set query routing keyspace.serialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets the serialConsistencyLevelto use.Sets the request timeout.timestamp(long timestamp) Sets the timestamp of write operations.Sets the timestamp of write operations.tracing(boolean tracing) Enables statement tracing.ttl(int ttl) Sets the time to live in seconds for write operations.Sets the time to live in seconds for write operations.Use light-weight transactions by applyingIF NOT EXISTS.Insert null values from an entity.withInsertNulls(boolean insertNulls) Insert null values from an entity.Enables statement tracing.Methods inherited from class org.springframework.data.cassandra.core.cql.QueryOptions.QueryOptionsBuilder
readTimeout
-
Method Details
-
consistencyLevel
public InsertOptions.InsertOptionsBuilder consistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Description copied from class:QueryOptions.QueryOptionsBuilderSets theConsistencyLevelto use.- Overrides:
consistencyLevelin classWriteOptions.WriteOptionsBuilder- Parameters:
consistencyLevel- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
executionProfile
Description copied from class:QueryOptions.QueryOptionsBuilderSets theexecution profileto use.- Overrides:
executionProfilein classWriteOptions.WriteOptionsBuilder- Parameters:
profileName- must not be null or empty.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setExecutionProfileName(String)
-
executionProfile
public InsertOptions.InsertOptionsBuilder executionProfile(ExecutionProfileResolver executionProfileResolver) Description copied from class:QueryOptions.QueryOptionsBuilderSets theExecutionProfileResolverto use.- Overrides:
executionProfilein classWriteOptions.WriteOptionsBuilder- Parameters:
executionProfileResolver- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setExecutionProfile(DriverExecutionProfile)
-
fetchSize
Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilderSets the query fetch size forResultSetchunks.The fetch size controls how much resulting rows will be retrieved simultaneously (the goal being to avoid loading too much results in memory for queries yielding large results). Please note that while value as low as 1 can be used, it is *highly* discouraged to use such a low value in practice as it will yield very poor performance.
- Overrides:
fetchSizein classWriteOptions.WriteOptionsBuilder- Parameters:
fetchSize- the number of rows to fetch per chunking request. To disable chunking of the result set, usefetchSize == Integer.MAX_VALUE. Negative values are not allowed.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
idempotent
Description copied from class:QueryOptions.QueryOptionsBuilderSet query execution idempotency.- Overrides:
idempotentin classWriteOptions.WriteOptionsBuilder- Parameters:
idempotent- true to mark the query as idempotent.- Returns:
thisQueryOptions.QueryOptionsBuilder.
-
keyspace
public InsertOptions.InsertOptionsBuilder keyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Description copied from class:QueryOptions.QueryOptionsBuilderSets thekeyspaceto use. If left unconfigured, then the keyspace set on the statement orCqlSessionwill be used.- Overrides:
keyspacein classWriteOptions.WriteOptionsBuilder- Parameters:
keyspace- the specific keyspace to use to run a statement, must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder.
-
pageSize
Description copied from class:QueryOptions.QueryOptionsBuilderSets the query fetch size forResultSetchunks.The fetch size controls how much resulting rows will be retrieved simultaneously (the goal being to avoid loading too many results in memory for queries yielding large results). Please note that while value as low as 1 can be used, it is highly discouraged to use such a low value in practice as it will yield very poor performance.
- Overrides:
pageSizein classWriteOptions.WriteOptionsBuilder- Parameters:
pageSize- the number of rows to fetch per chunking request. To disable chunking of the result set, usepageSize == Integer.MAX_VALUE. Negative values are not allowed.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
readTimeout
Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilderSets the read timeout in milliseconds. Overrides the default per-host read timeout.- Overrides:
readTimeoutin classWriteOptions.WriteOptionsBuilder- Parameters:
readTimeout- the read timeout in milliseconds. Negative values are not allowed. If it is0, the read timeout will be disabled for this statement.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setTimeout(Duration)
-
readTimeout
@Deprecated public InsertOptions.InsertOptionsBuilder readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilderSets the read timeout. Overrides the default per-host read timeout.- Overrides:
readTimeoutin classWriteOptions.WriteOptionsBuilder- Parameters:
readTimeout- the read timeout value. Negative values are not allowed. If it is0, the read timeout will be disabled for this statement.timeUnit- theTimeUnitfor the supplied timeout; must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setTimeout(Duration)
-
routingKeyspace
public InsertOptions.InsertOptionsBuilder routingKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace) Description copied from class:QueryOptions.QueryOptionsBuilderSet query routing keyspace.- Overrides:
routingKeyspacein classWriteOptions.WriteOptionsBuilder- Parameters:
routingKeyspace- the routing keyspace to use for token-aware routing.- Returns:
thisQueryOptions.QueryOptionsBuilder.
-
routingKey
Description copied from class:QueryOptions.QueryOptionsBuilderSet query routing key.- Overrides:
routingKeyin classWriteOptions.WriteOptionsBuilder- Parameters:
routingKey- the routing key to use for token-aware routing.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
serialConsistencyLevel
public InsertOptions.InsertOptionsBuilder serialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Description copied from class:QueryOptions.QueryOptionsBuilderSets the serialConsistencyLevelto use.- Overrides:
serialConsistencyLevelin classWriteOptions.WriteOptionsBuilder- Parameters:
consistencyLevel- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
timeout
Description copied from class:QueryOptions.QueryOptionsBuilderSets the request timeout. Overrides the default timeout.- Overrides:
timeoutin classWriteOptions.WriteOptionsBuilder- Parameters:
timeout- the read timeout. Negative values are not allowed. If it is0, the read timeout will be disabled for this statement.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setTimeout(Duration)
-
ttl
Description copied from class:WriteOptions.WriteOptionsBuilderSets the time to live in seconds for write operations.- Overrides:
ttlin classWriteOptions.WriteOptionsBuilder- Parameters:
ttl- the time to live.- Returns:
thisWriteOptions.WriteOptionsBuilder
-
tracing
Description copied from class:QueryOptions.QueryOptionsBuilderEnables statement tracing.- Overrides:
tracingin classWriteOptions.WriteOptionsBuilder- Parameters:
tracing- true to enable statement tracing to the executed statements.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
withTracing
Description copied from class:QueryOptions.QueryOptionsBuilderEnables statement tracing.- Overrides:
withTracingin classWriteOptions.WriteOptionsBuilder- Returns:
thisQueryOptions.QueryOptionsBuilder
-
ttl
Description copied from class:WriteOptions.WriteOptionsBuilderSets the time to live in seconds for write operations.- Overrides:
ttlin classWriteOptions.WriteOptionsBuilder- Parameters:
ttl- the time to live.- Returns:
thisWriteOptions.WriteOptionsBuilder
-
timestamp
Description copied from class:WriteOptions.WriteOptionsBuilderSets the timestamp of write operations.- Overrides:
timestampin classWriteOptions.WriteOptionsBuilder- Parameters:
timestamp- mutation timestamp in microseconds.- Returns:
thisWriteOptions.WriteOptionsBuilder- See Also:
-
timestamp
Description copied from class:WriteOptions.WriteOptionsBuilderSets the timestamp of write operations.- Overrides:
timestampin classWriteOptions.WriteOptionsBuilder- Parameters:
timestamp- mutation date time.- Returns:
thisWriteOptions.WriteOptionsBuilder
-
withIfNotExists
Use light-weight transactions by applyingIF NOT EXISTS.- Returns:
thisInsertOptions.InsertOptionsBuilder
-
ifNotExists
Use light-weight transactions by applyingIF NOT EXISTS.- Parameters:
ifNotExists- true to enableIF NOT EXISTS.- Returns:
thisInsertOptions.InsertOptionsBuilder
-
withInsertNulls
Insert null values from an entity. This allows the usage ofINSERTstatements as upsert by ensuring that the whole entity state is persisted. Inserting nulls in Cassandra creates tombstones so this option should be used with caution.- Returns:
thisInsertOptions.InsertOptionsBuilder- Since:
- 2.1
-
withInsertNulls
Insert null values from an entity. This allows the usage ofINSERTstatements as upsert by ensuring that the whole entity state is persisted. Inserting nulls in Cassandra creates tombstones so this option should be used with caution.- Parameters:
insertNulls- true to enable insertion of null values.- Returns:
thisInsertOptions.InsertOptionsBuilder- Since:
- 2.1
-
build
Builds a newInsertOptionswith the configured values.- Overrides:
buildin classWriteOptions.WriteOptionsBuilder- Returns:
- a new
InsertOptionswith the configured values
-