Interface ScyllaDBTemplate

All Superinterfaces:
org.eclipse.jnosql.mapping.column.ColumnTemplate, org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate, jakarta.nosql.Template

public interface ScyllaDBTemplate extends org.eclipse.jnosql.mapping.column.ColumnTemplate
A ScyllaDB-specific extension of ColumnTemplate, providing additional functionality for interacting with a ScyllaDB database using CQL queries and different consistency levels.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    count(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Returns the count of records that match the given SelectQuery using the specified ConsistencyLevel.
    <T> Stream<T>
    cql(String query)
    Executes a raw CQL query.
    <T> Stream<T>
    cql(String query, Object... params)
    Executes a CQL query with positional parameters.
    <T> Stream<T>
    cql(String query, Map<String,Object> values)
    Executes a CQL query with named parameters.
    void
    delete(org.eclipse.jnosql.communication.semistructured.DeleteQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Deletes records based on a DeleteQuery with a specified ConsistencyLevel.
    <T> Stream<T>
    execute(com.datastax.oss.driver.api.core.cql.SimpleStatement statement)
    Executes a SimpleStatement in ScyllaDB.
    <T> Stream<T>
    find(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Executes a SelectQuery using a specified ConsistencyLevel and retrieves the matching records.
    <T> Iterable<T>
    save(Iterable<T> entities, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Saves multiple entities with a specified ConsistencyLevel.
    <T> Iterable<T>
    save(Iterable<T> entities, Duration ttl, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Saves multiple entities with a specified ConsistencyLevel and a time-to-live (TTL) duration.
    <T> T
    save(T entity, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Saves an entity with a specified ConsistencyLevel.
    <T> T
    save(T entity, Duration ttl, com.datastax.oss.driver.api.core.ConsistencyLevel level)
    Saves an entity with a specified ConsistencyLevel and a time-to-live (TTL) duration.

    Methods inherited from interface org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate

    count, count, count, delete, deleteAll, exists, findAll, prepare, prepare, query, query, select, selectCursor, selectOffSet, singleResult, singleResult, singleResult

    Methods inherited from interface jakarta.nosql.Template

    delete, delete, find, insert, insert, insert, insert, select, update, update
  • Method Details

    • save

      <T> T save(T entity, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Saves an entity with a specified ConsistencyLevel.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to be saved
      level - the desired ConsistencyLevel for the operation
      Returns:
      the saved entity
      Throws:
      NullPointerException - if either entity or level is null
    • save

      <T> Iterable<T> save(Iterable<T> entities, Duration ttl, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Saves multiple entities with a specified ConsistencyLevel and a time-to-live (TTL) duration.
      Type Parameters:
      T - the type of the entities
      Parameters:
      entities - the iterable collection of entities to be saved
      ttl - the time-to-live duration for the records
      level - the desired ConsistencyLevel for the operation
      Returns:
      an iterable containing the saved entities
      Throws:
      NullPointerException - if entities, ttl, or level is null
    • save

      <T> Iterable<T> save(Iterable<T> entities, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Saves multiple entities with a specified ConsistencyLevel.
      Type Parameters:
      T - the type of the entities
      Parameters:
      entities - the iterable collection of entities to be saved
      level - the desired ConsistencyLevel for the operation
      Returns:
      an iterable containing the saved entities
      Throws:
      NullPointerException - if entities or level is null
    • save

      <T> T save(T entity, Duration ttl, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Saves an entity with a specified ConsistencyLevel and a time-to-live (TTL) duration.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to be saved
      ttl - the time-to-live duration for the record
      level - the desired ConsistencyLevel for the operation
      Returns:
      the saved entity
      Throws:
      NullPointerException - if entity, ttl, or level is null
    • delete

      void delete(org.eclipse.jnosql.communication.semistructured.DeleteQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Deletes records based on a DeleteQuery with a specified ConsistencyLevel.
      Parameters:
      query - the delete query defining the criteria for deletion
      level - the desired ConsistencyLevel for the operation
      Throws:
      NullPointerException - if either query or level is null
    • count

      long count(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Returns the count of records that match the given SelectQuery using the specified ConsistencyLevel.
      Parameters:
      query - the select query defining the criteria for counting; must not be null
      level - the ScyllaDB consistency level to use for the operation; must not be null
      Returns:
      the number of records matching the query
      Throws:
      NullPointerException - if query or level is null
    • find

      <T> Stream<T> find(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level)
      Executes a SelectQuery using a specified ConsistencyLevel and retrieves the matching records.
      Type Parameters:
      T - the type of the result
      Parameters:
      query - the select query defining the criteria for data retrieval
      level - the desired ConsistencyLevel for the operation
      Returns:
      a stream of results matching the query criteria
    • cql

      <T> Stream<T> cql(String query)
      Executes a raw CQL query.
      Type Parameters:
      T - the type of the result
      Parameters:
      query - the CQL query to be executed
      Returns:
      a stream containing the results of the query
      Throws:
      NullPointerException - if query is null
    • cql

      <T> Stream<T> cql(String query, Map<String,Object> values)
      Executes a CQL query with named parameters.

      Example usage:

      
       template.cql("SELECT * FROM users WHERE id = :id", Map.of("id", 1));
       
      Type Parameters:
      T - the type of the result
      Parameters:
      query - the CQL query with named placeholders
      values - a map of parameter names to values
      Returns:
      a stream containing the results of the query
      Throws:
      NullPointerException - if query is null
    • cql

      <T> Stream<T> cql(String query, Object... params)
      Executes a CQL query with positional parameters.
      Type Parameters:
      T - the type of the result
      Parameters:
      query - the CQL query with positional placeholders
      params - the values to be bound to the query placeholders
      Returns:
      a stream containing the results of the query
      Throws:
      NullPointerException - if query is null
    • execute

      <T> Stream<T> execute(com.datastax.oss.driver.api.core.cql.SimpleStatement statement)
      Executes a SimpleStatement in ScyllaDB.
      Type Parameters:
      T - the type of the result
      Parameters:
      statement - the prepared SimpleStatement to be executed
      Returns:
      a stream containing the results of the query
      Throws:
      NullPointerException - if statement is null