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, ttl
Fields 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 newInsertOptions
with the configured values.consistencyLevel
(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets theConsistencyLevel
to use.executionProfile
(String profileName) Sets theexecution profile
to use.executionProfile
(ExecutionProfileResolver executionProfileResolver) Sets theExecutionProfileResolver
to 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 thekeyspace
to use.pageSize
(int pageSize) Sets the query fetch size forResultSet
chunks.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 serialConsistencyLevel
to 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.QueryOptionsBuilder
Sets theConsistencyLevel
to use.- Overrides:
consistencyLevel
in classWriteOptions.WriteOptionsBuilder
- Parameters:
consistencyLevel
- must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
executionProfile
Description copied from class:QueryOptions.QueryOptionsBuilder
Sets theexecution profile
to use.- Overrides:
executionProfile
in classWriteOptions.WriteOptionsBuilder
- Parameters:
profileName
- must not be null or empty.- Returns:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setExecutionProfileName(String)
-
executionProfile
public InsertOptions.InsertOptionsBuilder executionProfile(ExecutionProfileResolver executionProfileResolver) Description copied from class:QueryOptions.QueryOptionsBuilder
Sets theExecutionProfileResolver
to use.- Overrides:
executionProfile
in classWriteOptions.WriteOptionsBuilder
- Parameters:
executionProfileResolver
- must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setExecutionProfile(DriverExecutionProfile)
-
fetchSize
Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the query fetch size forResultSet
chunks.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:
fetchSize
in 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:
this
QueryOptions.QueryOptionsBuilder
-
idempotent
Description copied from class:QueryOptions.QueryOptionsBuilder
Set query execution idempotency.- Overrides:
idempotent
in classWriteOptions.WriteOptionsBuilder
- Parameters:
idempotent
- true to mark the query as idempotent.- Returns:
this
QueryOptions.QueryOptionsBuilder
.
-
keyspace
public InsertOptions.InsertOptionsBuilder keyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Description copied from class:QueryOptions.QueryOptionsBuilder
Sets thekeyspace
to use. If left unconfigured, then the keyspace set on the statement orCqlSession
will be used.- Overrides:
keyspace
in classWriteOptions.WriteOptionsBuilder
- Parameters:
keyspace
- the specific keyspace to use to run a statement, must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
.
-
pageSize
Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the query fetch size forResultSet
chunks.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:
pageSize
in 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:
this
QueryOptions.QueryOptionsBuilder
-
readTimeout
Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the read timeout in milliseconds. Overrides the default per-host read timeout.- Overrides:
readTimeout
in 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:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setTimeout(Duration)
-
readTimeout
@Deprecated public InsertOptions.InsertOptionsBuilder readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated.Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the read timeout. Overrides the default per-host read timeout.- Overrides:
readTimeout
in 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
- theTimeUnit
for the supplied timeout; must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setTimeout(Duration)
-
routingKeyspace
public InsertOptions.InsertOptionsBuilder routingKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace) Description copied from class:QueryOptions.QueryOptionsBuilder
Set query routing keyspace.- Overrides:
routingKeyspace
in classWriteOptions.WriteOptionsBuilder
- Parameters:
routingKeyspace
- the routing keyspace to use for token-aware routing.- Returns:
this
QueryOptions.QueryOptionsBuilder
.
-
routingKey
Description copied from class:QueryOptions.QueryOptionsBuilder
Set query routing key.- Overrides:
routingKey
in classWriteOptions.WriteOptionsBuilder
- Parameters:
routingKey
- the routing key to use for token-aware routing.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
serialConsistencyLevel
public InsertOptions.InsertOptionsBuilder serialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the serialConsistencyLevel
to use.- Overrides:
serialConsistencyLevel
in classWriteOptions.WriteOptionsBuilder
- Parameters:
consistencyLevel
- must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
timeout
Description copied from class:QueryOptions.QueryOptionsBuilder
Sets the request timeout. Overrides the default timeout.- Overrides:
timeout
in 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:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setTimeout(Duration)
-
ttl
Description copied from class:WriteOptions.WriteOptionsBuilder
Sets the time to live in seconds for write operations.- Overrides:
ttl
in classWriteOptions.WriteOptionsBuilder
- Parameters:
ttl
- the time to live.- Returns:
this
WriteOptions.WriteOptionsBuilder
-
tracing
Description copied from class:QueryOptions.QueryOptionsBuilder
Enables statement tracing.- Overrides:
tracing
in classWriteOptions.WriteOptionsBuilder
- Parameters:
tracing
- true to enable statement tracing to the executed statements.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
withTracing
Description copied from class:QueryOptions.QueryOptionsBuilder
Enables statement tracing.- Overrides:
withTracing
in classWriteOptions.WriteOptionsBuilder
- Returns:
this
QueryOptions.QueryOptionsBuilder
-
ttl
Description copied from class:WriteOptions.WriteOptionsBuilder
Sets the time to live in seconds for write operations.- Overrides:
ttl
in classWriteOptions.WriteOptionsBuilder
- Parameters:
ttl
- the time to live.- Returns:
this
WriteOptions.WriteOptionsBuilder
-
timestamp
Description copied from class:WriteOptions.WriteOptionsBuilder
Sets the timestamp of write operations.- Overrides:
timestamp
in classWriteOptions.WriteOptionsBuilder
- Parameters:
timestamp
- mutation timestamp in microseconds.- Returns:
this
WriteOptions.WriteOptionsBuilder
- See Also:
-
timestamp
Description copied from class:WriteOptions.WriteOptionsBuilder
Sets the timestamp of write operations.- Overrides:
timestamp
in classWriteOptions.WriteOptionsBuilder
- Parameters:
timestamp
- mutation date time.- Returns:
this
WriteOptions.WriteOptionsBuilder
-
withIfNotExists
Use light-weight transactions by applyingIF NOT EXISTS
.- Returns:
this
InsertOptions.InsertOptionsBuilder
-
ifNotExists
Use light-weight transactions by applyingIF NOT EXISTS
.- Parameters:
ifNotExists
- true to enableIF NOT EXISTS
.- Returns:
this
InsertOptions.InsertOptionsBuilder
-
withInsertNulls
Insert null values from an entity. This allows the usage ofINSERT
statements 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:
this
InsertOptions.InsertOptionsBuilder
- Since:
- 2.1
-
withInsertNulls
Insert null values from an entity. This allows the usage ofINSERT
statements 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:
this
InsertOptions.InsertOptionsBuilder
- Since:
- 2.1
-
build
Builds a newInsertOptions
with the configured values.- Overrides:
build
in classWriteOptions.WriteOptionsBuilder
- Returns:
- a new
InsertOptions
with the configured values
-