Class StatementFactory

java.lang.Object
org.springframework.data.cassandra.core.StatementFactory

public class StatementFactory extends Object
Factory to render Statement objects from Query and Update objects.
Since:
2.0
Author:
Mark Paluch, John Blum, Sam Lightfoot
See Also:
  • Constructor Details

  • Method Details

    • getQueryMapper

      protected QueryMapper getQueryMapper()
      Returns the QueryMapper used to map Query to CQL-specific data types.
      Returns:
      the QueryMapper used to map Query to CQL-specific data types.
      See Also:
    • getUpdateMapper

      protected UpdateMapper getUpdateMapper()
      Returns the UpdateMapper used to map Update to CQL-specific data types.
      Returns:
      the UpdateMapper used to map Update to CQL-specific data types.
      See Also:
    • count

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.select.Select> count(Query query, CassandraPersistentEntity<?> persistentEntity)
      Create a COUNT statement by mapping Query to Select.
      Parameters:
      query - user-defined count Query to execute; must not be null.
      persistentEntity - entity to count; must not be null.
      Returns:
      the select builder.
      Since:
      2.1
    • count

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.select.Select> count(Query query, CassandraPersistentEntity<?> entity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create a COUNT statement by mapping Query to Select.
      Parameters:
      query - user-defined count Query to execute; must not be null.
      entity - entity to count; must not be null.
      tableName - must not be null.
      Returns:
      the select builder.
      Since:
      2.1
    • selectOneById

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.select.Select> selectOneById(Object id, CassandraPersistentEntity<?> persistentEntity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create an SELECT statement by mapping id to SELECT … WHERE considering UpdateOptions.
      Parameters:
      id - must not be null.
      persistentEntity - must not be null.
      tableName - must not be null.
      Returns:
      the select builder.
    • select

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.select.Select> select(Query query, CassandraPersistentEntity<?> persistentEntity)
      Create a SELECT statement by mapping Query to Select.
      Parameters:
      query - must not be null.
      persistentEntity - must not be null.
      Returns:
      the select builder.
    • select

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.select.Select> select(Query query, CassandraPersistentEntity<?> persistentEntity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create a SELECT statement by mapping Query to Select.
      Parameters:
      query - must not be null.
      persistentEntity - must not be null.
      tableName - must not be null.
      Returns:
      the select builder.
      Since:
      2.1
    • insert

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.insert.RegularInsert> insert(Object objectToInsert, WriteOptions options)
      Creates a Query Object for an insert.
      Parameters:
      objectToInsert - the object to save, must not be null.
      options - optional WriteOptions to apply to the Insert statement, may be null.
      Returns:
      the select builder.
      Since:
      3.0
    • insert

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.insert.RegularInsert> insert(Object objectToInsert, WriteOptions options, CassandraPersistentEntity<?> persistentEntity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Creates a Query Object for an insert.
      Parameters:
      tableName - the table name, must not be empty and not null.
      objectToInsert - the object to save, must not be null.
      options - optional WriteOptions to apply to the Insert statement, may be null.
      persistentEntity - the CassandraPersistentEntity to write insert values.
      Returns:
      the select builder.
    • update

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.update.Update> update(Query query, Update update, CassandraPersistentEntity<?> persistentEntity)
      Create an UPDATE statement by mapping Query to Update.
      Parameters:
      query - must not be null.
      persistentEntity - must not be null.
      Returns:
      the update builder.
    • update

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.update.Update> update(Object objectToUpdate, WriteOptions options)
      Create an UPDATE statement by mapping objectToUpdate to Update considering UpdateOptions.
      Parameters:
      objectToUpdate - must not be null.
      options - must not be null.
      Returns:
      the update builder.
      Since:
      3.0
    • update

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.update.Update> update(Object objectToUpdate, WriteOptions options, CassandraPersistentEntity<?> entity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create an UPDATE statement by mapping objectToUpdate to Update considering UpdateOptions.
      Parameters:
      objectToUpdate - must not be null.
      options - must not be null.
      entity - must not be null.
      tableName - must not be null.
      Returns:
      the update builder.
    • deleteById

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.delete.Delete> deleteById(Object id, CassandraPersistentEntity<?> persistentEntity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create an DELETE statement by mapping id to SELECT … WHERE considering UpdateOptions.
      Parameters:
      id - must not be null.
      persistentEntity - must not be null.
      tableName - must not be null.
      Returns:
      the delete builder.
    • delete

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.delete.Delete> delete(Query query, CassandraPersistentEntity<?> persistentEntity)
      Create a DELETE statement by mapping Query to Delete.
      Parameters:
      query - must not be null.
      persistentEntity - must not be null.
      Returns:
      the delete builder.
    • delete

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.delete.Delete> delete(Query query, CassandraPersistentEntity<?> persistentEntity, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create a DELETE statement by mapping Query to Delete.
      Parameters:
      query - must not be null.
      persistentEntity - must not be null.
      tableName - must not be null.
      Returns:
      the delete builder.
    • delete

      public StatementBuilder<com.datastax.oss.driver.api.querybuilder.delete.Delete> delete(Object entity, QueryOptions options, EntityWriter<Object,Object> entityWriter, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Create an DELETE statement by mapping entity to DELETE … WHERE considering WriteOptions.
      Parameters:
      entity - must not be null.
      options - must not be null.
      entityWriter - must not be null.
      tableName - must not be null.
      Returns:
      the delete builder.