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 TypeMethodDescriptionlongcount(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level) Returns the count of records that match the givenSelectQueryusing the specifiedConsistencyLevel.<T> Stream<T>Executes a raw CQL query.<T> Stream<T>Executes a CQL query with positional parameters.<T> Stream<T>Executes a CQL query with named parameters.voiddelete(org.eclipse.jnosql.communication.semistructured.DeleteQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level) Deletes records based on aDeleteQuerywith a specifiedConsistencyLevel.<T> Stream<T>execute(com.datastax.oss.driver.api.core.cql.SimpleStatement statement) Executes aSimpleStatementin ScyllaDB.<T> Stream<T>find(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level) Executes aSelectQueryusing a specifiedConsistencyLeveland retrieves the matching records.<T> Iterable<T>Saves multiple entities with a specifiedConsistencyLevel.<T> Iterable<T>Saves multiple entities with a specifiedConsistencyLeveland a time-to-live (TTL) duration.<T> Tsave(T entity, com.datastax.oss.driver.api.core.ConsistencyLevel level) Saves an entity with a specifiedConsistencyLevel.<T> TSaves an entity with a specifiedConsistencyLeveland 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, singleResultMethods 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 specifiedConsistencyLevel.- Type Parameters:
T- the type of the entity- Parameters:
entity- the entity to be savedlevel- the desiredConsistencyLevelfor the operation- Returns:
- the saved entity
- Throws:
NullPointerException- if eitherentityorlevelisnull
-
save
<T> Iterable<T> save(Iterable<T> entities, Duration ttl, com.datastax.oss.driver.api.core.ConsistencyLevel level) Saves multiple entities with a specifiedConsistencyLeveland a time-to-live (TTL) duration.- Type Parameters:
T- the type of the entities- Parameters:
entities- the iterable collection of entities to be savedttl- the time-to-live duration for the recordslevel- the desiredConsistencyLevelfor the operation- Returns:
- an iterable containing the saved entities
- Throws:
NullPointerException- ifentities,ttl, orlevelisnull
-
save
Saves multiple entities with a specifiedConsistencyLevel.- Type Parameters:
T- the type of the entities- Parameters:
entities- the iterable collection of entities to be savedlevel- the desiredConsistencyLevelfor the operation- Returns:
- an iterable containing the saved entities
- Throws:
NullPointerException- ifentitiesorlevelisnull
-
save
Saves an entity with a specifiedConsistencyLeveland a time-to-live (TTL) duration.- Type Parameters:
T- the type of the entity- Parameters:
entity- the entity to be savedttl- the time-to-live duration for the recordlevel- the desiredConsistencyLevelfor the operation- Returns:
- the saved entity
- Throws:
NullPointerException- ifentity,ttl, orlevelisnull
-
delete
void delete(org.eclipse.jnosql.communication.semistructured.DeleteQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level) Deletes records based on aDeleteQuerywith a specifiedConsistencyLevel.- Parameters:
query- the delete query defining the criteria for deletionlevel- the desiredConsistencyLevelfor the operation- Throws:
NullPointerException- if eitherqueryorlevelisnull
-
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 givenSelectQueryusing the specifiedConsistencyLevel.- Parameters:
query- the select query defining the criteria for counting; must not benulllevel- the ScyllaDB consistency level to use for the operation; must not benull- Returns:
- the number of records matching the query
- Throws:
NullPointerException- ifqueryorlevelisnull
-
find
<T> Stream<T> find(org.eclipse.jnosql.communication.semistructured.SelectQuery query, com.datastax.oss.driver.api.core.ConsistencyLevel level) Executes aSelectQueryusing a specifiedConsistencyLeveland retrieves the matching records.- Type Parameters:
T- the type of the result- Parameters:
query- the select query defining the criteria for data retrievallevel- the desiredConsistencyLevelfor the operation- Returns:
- a stream of results matching the query criteria
-
cql
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- ifqueryisnull
-
cql
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 placeholdersvalues- a map of parameter names to values- Returns:
- a stream containing the results of the query
- Throws:
NullPointerException- ifqueryisnull
-
cql
Executes a CQL query with positional parameters.- Type Parameters:
T- the type of the result- Parameters:
query- the CQL query with positional placeholdersparams- the values to be bound to the query placeholders- Returns:
- a stream containing the results of the query
- Throws:
NullPointerException- ifqueryisnull
-
execute
Executes aSimpleStatementin ScyllaDB.- Type Parameters:
T- the type of the result- Parameters:
statement- the preparedSimpleStatementto be executed- Returns:
- a stream containing the results of the query
- Throws:
NullPointerException- ifstatementisnull
-