Class QueryOptions.QueryOptionsBuilder

java.lang.Object
org.springframework.data.cassandra.core.cql.QueryOptions.QueryOptionsBuilder
Direct Known Subclasses:
WriteOptions.WriteOptionsBuilder
Enclosing class:
QueryOptions

public static class QueryOptions.QueryOptionsBuilder extends Object
Builder for QueryOptions.
Since:
1.5
Author:
Mark Paluch, Seungho Kang
  • Field Details

    • consistencyLevel

      @Nullable protected com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel
    • executionProfileResolver

      protected ExecutionProfileResolver executionProfileResolver
    • idempotent

      @Nullable protected Boolean idempotent
    • keyspace

      @Nullable protected com.datastax.oss.driver.api.core.CqlIdentifier keyspace
    • routingKey

      @Nullable protected ByteBuffer routingKey
    • routingKeyspace

      @Nullable protected com.datastax.oss.driver.api.core.CqlIdentifier routingKeyspace
    • pageSize

      @Nullable protected Integer pageSize
    • serialConsistencyLevel

      @Nullable protected com.datastax.oss.driver.api.core.ConsistencyLevel serialConsistencyLevel
    • timeout

      protected Duration timeout
    • tracing

      @Nullable protected Boolean tracing
  • Method Details

    • consistencyLevel

      public QueryOptions.QueryOptionsBuilder consistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel)
      Sets the ConsistencyLevel to use.
      Parameters:
      consistencyLevel - must not be null.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • executionProfile

      public QueryOptions.QueryOptionsBuilder executionProfile(String profileName)
      Sets the execution 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 the ExecutionProfileResolver to use.
      Parameters:
      executionProfileResolver - must not be null.
      Returns:
      this QueryOptions.QueryOptionsBuilder
      See Also:
      • Statement.setExecutionProfile(DriverExecutionProfile)
    • fetchSize

      @Deprecated(forRemoval=true) public QueryOptions.QueryOptionsBuilder fetchSize(int fetchSize)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.0, use pageSize(int).
      Sets the query fetch size for ResultSet 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, use fetchSize == Integer.MAX_VALUE. Negative values are not allowed.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • idempotent

      public QueryOptions.QueryOptionsBuilder idempotent(boolean 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 the keyspace to use. If left unconfigured, then the keyspace set on the statement or CqlSession 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

      public QueryOptions.QueryOptionsBuilder pageSize(int pageSize)
      Sets the query fetch size for ResultSet 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, use pageSize == Integer.MAX_VALUE. Negative values are not allowed.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • readTimeout

      @Deprecated(forRemoval=true) public QueryOptions.QueryOptionsBuilder readTimeout(long readTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.0, use timeout(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 is 0, the read timeout will be disabled for this statement.
      Returns:
      this QueryOptions.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, use timeout(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 is 0, the read timeout will be disabled for this statement.
      timeUnit - the TimeUnit for the supplied timeout; must not be null.
      Returns:
      this QueryOptions.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, use timeout(Duration)
      Sets the read timeout. Overrides the default per-host read timeout.
      Parameters:
      readTimeout - the read timeout. Negative values are not allowed. If it is 0, 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

      public QueryOptions.QueryOptionsBuilder routingKey(ByteBuffer 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 serial ConsistencyLevel to use.
      Parameters:
      consistencyLevel - must not be null.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • timeout

      public QueryOptions.QueryOptionsBuilder timeout(Duration timeout)
      Sets the request timeout. Overrides the default timeout.
      Parameters:
      timeout - the read timeout. Negative values are not allowed. If it is 0, the read timeout will be disabled for this statement.
      Returns:
      this QueryOptions.QueryOptionsBuilder
      Since:
      3.0
      See Also:
      • Statement.setTimeout(Duration)
    • tracing

      public QueryOptions.QueryOptionsBuilder tracing(boolean tracing)
      Enables statement tracing.
      Parameters:
      tracing - true to enable statement tracing to the executed statements.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • withTracing

      public QueryOptions.QueryOptionsBuilder withTracing()
      Enables statement tracing.
      Returns:
      this QueryOptions.QueryOptionsBuilder
    • build

      public QueryOptions build()
      Builds a new QueryOptions with the configured values.
      Returns:
      a new QueryOptions with the configured values