Package jakarta.nosql.column
Interface ColumnFamilyManager
-
- All Superinterfaces:
AutoCloseable
public interface ColumnFamilyManager extends AutoCloseable
Interface used to interact with the persistence context toColumnEntity
The ColumnFamilyManager API is used to create and remove persistentColumnEntity
instances, to select entities by their primary key, and to select over entities.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
closes a resourcelong
count(String columnFamily)
Returns the number of elements from column familyvoid
delete(ColumnDeleteQuery query)
Deletes an entityColumnEntity
insert(ColumnEntity entity)
Saves a Column family entityColumnEntity
insert(ColumnEntity entity, Duration ttl)
Saves a Column family entity with time to liveIterable<ColumnEntity>
insert(Iterable<ColumnEntity> entities)
Saves a Column family entities, by default it's just run for each saving usinginsert(ColumnEntity)
, each NoSQL vendor might replace to a more appropriate one.Iterable<ColumnEntity>
insert(Iterable<ColumnEntity> entities, Duration ttl)
Saves a Column family entity with time to live, by default it's just run for each saving usinginsert(ColumnEntity, Duration)
, each NoSQL vendor might replace to a more appropriate one.default ColumnPreparedStatement
prepare(String query)
Executes a query and returns the result, when the operations are insert, update and select command it will return the result of the operation when the command is delete it will return an empty collection.default Stream<ColumnEntity>
query(String query)
Executes a query and returns the result, when the operations are insert, update and select command it will return the result of the operation when the command is delete it will return an empty collection.Stream<ColumnEntity>
select(ColumnQuery query)
FindsColumnEntity
from selectdefault Optional<ColumnEntity>
singleResult(ColumnQuery query)
Returns a single entity from selectColumnEntity
update(ColumnEntity entity)
Updates a Column family entityIterable<ColumnEntity>
update(Iterable<ColumnEntity> entities)
Updates a Column family entities, by default it's just run for each saving usingupdate(ColumnEntity)
, each NoSQL vendor might replace to a more appropriate one.
-
-
-
Method Detail
-
insert
ColumnEntity insert(ColumnEntity entity)
Saves a Column family entity- Parameters:
entity
- column family to be saved- Returns:
- the entity saved
- Throws:
NullPointerException
- when entity is null
-
update
ColumnEntity update(ColumnEntity entity)
Updates a Column family entity- Parameters:
entity
- column family to be saved- Returns:
- the entity saved
- Throws:
NullPointerException
- when entity is null
-
update
Iterable<ColumnEntity> update(Iterable<ColumnEntity> entities)
Updates a Column family entities, by default it's just run for each saving usingupdate(ColumnEntity)
, each NoSQL vendor might replace to a more appropriate one.- Parameters:
entities
- column family to be saved- Returns:
- the entity saved
- Throws:
NullPointerException
- when entities is null
-
insert
ColumnEntity insert(ColumnEntity entity, Duration ttl)
Saves a Column family entity with time to live- Parameters:
entity
- column family to be savedttl
- time to live- Returns:
- the entity saved
- Throws:
NullPointerException
- when either entity or ttl are nullUnsupportedOperationException
- when the database does not support this feature
-
insert
Iterable<ColumnEntity> insert(Iterable<ColumnEntity> entities)
Saves a Column family entities, by default it's just run for each saving usinginsert(ColumnEntity)
, each NoSQL vendor might replace to a more appropriate one.- Parameters:
entities
- column family to be saved- Returns:
- the entity saved
- Throws:
NullPointerException
- when entities is null
-
insert
Iterable<ColumnEntity> insert(Iterable<ColumnEntity> entities, Duration ttl)
Saves a Column family entity with time to live, by default it's just run for each saving usinginsert(ColumnEntity, Duration)
, each NoSQL vendor might replace to a more appropriate one.- Parameters:
entities
- column family to be savedttl
- time to live- Returns:
- the entity saved
- Throws:
NullPointerException
- when either entity or ttl are nullUnsupportedOperationException
- when the database does not support this feature
-
delete
void delete(ColumnDeleteQuery query)
Deletes an entity- Parameters:
query
- the select to delete an entity- Throws:
NullPointerException
- when either select or collection are nullUnsupportedOperationException
- if the implementation does not support any operation that a query has.
-
select
Stream<ColumnEntity> select(ColumnQuery query)
FindsColumnEntity
from select- Parameters:
query
- - select to figure out entities- Returns:
- entities found by select
- Throws:
NullPointerException
- when select is nullUnsupportedOperationException
- if the implementation does not support any operation that a query has.
-
query
default Stream<ColumnEntity> query(String query)
Executes a query and returns the result, when the operations are insert, update and select command it will return the result of the operation when the command is delete it will return an empty collection.- Parameters:
query
- the query asString
- Returns:
- the result of the operation if delete it will always return an empty list
- Throws:
NullPointerException
- when there is parameter nullIllegalArgumentException
- when the query has value parametersIllegalStateException
- when there is notColumnQueryParser
QueryException
- when there is error in the syntax
-
prepare
default ColumnPreparedStatement prepare(String query)
Executes a query and returns the result, when the operations are insert, update and select command it will return the result of the operation when the command is delete it will return an empty collection.- Parameters:
query
- the query asString
- Returns:
- a
ColumnPreparedStatement
instance - Throws:
NullPointerException
- when there is parameter nullIllegalStateException
- when there is notColumnQueryParser
QueryException
- when there is error in the syntax
-
singleResult
default Optional<ColumnEntity> singleResult(ColumnQuery query)
Returns a single entity from select- Parameters:
query
- - select to figure out entities- Returns:
- an entity on
Optional
orOptional.empty()
when the result is not found. - Throws:
NonUniqueResultException
- when the result has more than one entityNullPointerException
- when select is nullUnsupportedOperationException
- if the implementation does not support any operation that a query has.
-
count
long count(String columnFamily)
Returns the number of elements from column family- Parameters:
columnFamily
- the column family- Returns:
- the number of elements
- Throws:
NullPointerException
- when column family is nullUnsupportedOperationException
- when the database dot not have support
-
close
void close()
closes a resource- Specified by:
close
in interfaceAutoCloseable
-
-