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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.datastax.oss.driver.api.core.ConsistencyLevel
protected ExecutionProfileResolver
protected Boolean
protected com.datastax.oss.driver.api.core.CqlIdentifier
protected Integer
protected ByteBuffer
protected com.datastax.oss.driver.api.core.CqlIdentifier
protected com.datastax.oss.driver.api.core.ConsistencyLevel
protected Duration
protected Boolean
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newQueryOptions
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.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.since 3.0, usetimeout(Duration)
readTimeout
(long readTimeout, TimeUnit timeUnit) Deprecated.since 2.0, usetimeout(Duration)
.readTimeout
(Duration readTimeout) Deprecated.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 serialConsistencyLevel
to use.Sets the request timeout.tracing
(boolean tracing) Enables statement tracing.Enables statement tracing.
-
Field Details
-
consistencyLevel
@Nullable protected com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel -
executionProfileResolver
-
idempotent
-
keyspace
@Nullable protected com.datastax.oss.driver.api.core.CqlIdentifier keyspace -
routingKey
-
routingKeyspace
@Nullable protected com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace -
pageSize
-
serialConsistencyLevel
@Nullable protected com.datastax.oss.driver.api.core.ConsistencyLevel serialConsistencyLevel -
timeout
-
tracing
-
-
Method Details
-
consistencyLevel
public QueryOptions.QueryOptionsBuilder consistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets theConsistencyLevel
to use.- Parameters:
consistencyLevel
- must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
executionProfile
Sets theexecution profile
to use.- Parameters:
profileName
- must not be null or empty.- Returns:
this
QueryOptions.QueryOptionsBuilder
- Since:
- 3.0
- See Also:
-
Statement.setExecutionProfileName(String)
-
executionProfile
public QueryOptions.QueryOptionsBuilder executionProfile(ExecutionProfileResolver executionProfileResolver) Sets theExecutionProfileResolver
to use.- Parameters:
executionProfileResolver
- must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setExecutionProfile(DriverExecutionProfile)
-
fetchSize
Deprecated.since 3.0, usepageSize(int)
.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.
- 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
Set query execution idempotency.- Parameters:
idempotent
- true to mark the query as idempotent.- Returns:
this
QueryOptions.QueryOptionsBuilder
.- Since:
- 3.4
-
keyspace
public QueryOptions.QueryOptionsBuilder keyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Sets thekeyspace
to use. If left unconfigured, then the keyspace set on the statement orCqlSession
will be used.- Parameters:
keyspace
- the specific keyspace to use to run a statement, must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
.- Since:
- 3.1
-
pageSize
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.
- 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.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:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setTimeout(Duration)
-
readTimeout
@Deprecated public QueryOptions.QueryOptionsBuilder readTimeout(long readTimeout, TimeUnit timeUnit) Deprecated.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
- theTimeUnit
for the supplied timeout; must not be null.- Returns:
this
QueryOptions.QueryOptionsBuilder
- See Also:
-
Statement.setTimeout(Duration)
-
readTimeout
Deprecated.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:
this
QueryOptions.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:
this
QueryOptions.QueryOptionsBuilder
.- Since:
- 3.4
-
routingKey
Set query routing key.- Parameters:
routingKey
- the routing key to use for token-aware routing.- Returns:
this
QueryOptions.QueryOptionsBuilder
- Since:
- 3.4
-
serialConsistencyLevel
public QueryOptions.QueryOptionsBuilder serialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Sets the serialConsistencyLevel
to use.- Parameters:
consistencyLevel
- must not be null.- Returns:
this
QueryOptions.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:
this
QueryOptions.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:
this
QueryOptions.QueryOptionsBuilder
-
withTracing
Enables statement tracing.- Returns:
this
QueryOptions.QueryOptionsBuilder
-
build
Builds a newQueryOptions
with the configured values.- Returns:
- a new
QueryOptions
with the configured values
-
pageSize(int)
.