Module spring.data.cassandra
Class QueryOptions.QueryOptionsBuilder
java.lang.Object
org.springframework.data.cassandra.core.cql.QueryOptions.QueryOptionsBuilder
- Direct Known Subclasses:
WriteOptions.WriteOptionsBuilder
- Enclosing class:
- QueryOptions
Builder for
QueryOptions.- Since:
- 1.5
- Author:
- Mark Paluch, Seungho Kang
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.datastax.oss.driver.api.core.ConsistencyLevelprotected ExecutionProfileResolverprotected Booleanprotected com.datastax.oss.driver.api.core.CqlIdentifierprotected Integerprotected ByteBufferprotected com.datastax.oss.driver.api.core.CqlIdentifierprotected com.datastax.oss.driver.api.core.ConsistencyLevelprotected Durationprotected Boolean -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newQueryOptionswith 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, for removal: This API element is subject to removal in a future version.idempotent(boolean idempotent) Set query execution idempotency.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, for removal: This API element is subject to removal in a future version.since 3.0, usetimeout(Duration)readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated, for removal: This API element is subject to removal in a future version.since 2.0, usetimeout(Duration).readTimeout(Duration readTimeout) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0, usetimeout(Duration)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.tracing(boolean tracing) Enables statement tracing.Enables statement tracing.
-
Field Details
-
consistencyLevel
-
executionProfileResolver
-
idempotent
-
keyspace
-
routingKey
-
routingKeyspace
-
pageSize
-
serialConsistencyLevel
-
timeout
-
tracing
-
-
Method Details
-
consistencyLevel
public QueryOptions.QueryOptionsBuilder consistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets theConsistencyLevelto use.- Parameters:
consistencyLevel- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
executionProfile
Sets theexecution profileto use.- Parameters:
profileName- must not be null or empty.- Returns:
thisQueryOptions.QueryOptionsBuilder- Since:
- 3.0
- See Also:
-
Statement.setExecutionProfileName(String)
-
executionProfile
public QueryOptions.QueryOptionsBuilder executionProfile(ExecutionProfileResolver executionProfileResolver) Sets theExecutionProfileResolverto use.- Parameters:
executionProfileResolver- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder- See Also:
-
Statement.setExecutionProfile(DriverExecutionProfile)
-
fetchSize
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0, usepageSize(int).Sets 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.
- 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
Set query execution idempotency.- Parameters:
idempotent- true to mark the query as idempotent.- Returns:
thisQueryOptions.QueryOptionsBuilder.- Since:
- 3.4
-
keyspace
public QueryOptions.QueryOptionsBuilder keyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Sets thekeyspaceto use. If left unconfigured, then the keyspace set on the statement orCqlSessionwill be used.- Parameters:
keyspace- the specific keyspace to use to run a statement, must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder.- Since:
- 3.1
-
pageSize
Sets 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.
- 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, for removal: This API element is subject to removal in a future version.since 3.0, usetimeout(Duration)Sets the read timeout in milliseconds. Overrides the default per-host read timeout.- 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(forRemoval=true) public QueryOptions.QueryOptionsBuilder readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated, for removal: This API element is subject to removal in a future version.since 2.0, usetimeout(Duration).Sets the read timeout. Overrides the default per-host read timeout.- 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)
-
readTimeout
@Deprecated(forRemoval=true) public QueryOptions.QueryOptionsBuilder readTimeout(Duration readTimeout) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0, usetimeout(Duration)Sets the read timeout. Overrides the default per-host read timeout.- Parameters:
readTimeout- the read timeout. Negative values are not allowed. If it is0, the read timeout will be disabled for this statement.- Returns:
thisQueryOptions.QueryOptionsBuilder- Since:
- 2.0
- See Also:
-
Statement.setTimeout(Duration)
-
routingKeyspace
public QueryOptions.QueryOptionsBuilder routingKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace) Set query routing keyspace.- Parameters:
routingKeyspace- the routing keyspace to use for token-aware routing.- Returns:
thisQueryOptions.QueryOptionsBuilder.- Since:
- 3.4
-
routingKey
Set query routing key.- Parameters:
routingKey- the routing key to use for token-aware routing.- Returns:
thisQueryOptions.QueryOptionsBuilder- Since:
- 3.4
-
serialConsistencyLevel
public QueryOptions.QueryOptionsBuilder serialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets the serialConsistencyLevelto use.- Parameters:
consistencyLevel- must not be null.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
timeout
Sets the request timeout. Overrides the default timeout.- 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- Since:
- 3.0
- See Also:
-
Statement.setTimeout(Duration)
-
tracing
Enables statement tracing.- Parameters:
tracing- true to enable statement tracing to the executed statements.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
withTracing
Enables statement tracing.- Returns:
thisQueryOptions.QueryOptionsBuilder
-
build
Builds a newQueryOptionswith the configured values.- Returns:
- a new
QueryOptionswith the configured values
-
pageSize(int).