public interface DocumentTemplate
DocumentCollectionManager| Modifier and Type | Method and Description |
|---|---|
<T> long |
count(Class<T> entityType)
Returns the number of elements from document collection
|
long |
count(String documentCollection)
Returns the number of elements from document collection
|
<T,ID> void |
delete(Class<T> entityClass,
ID id)
Deletes by Id.
|
void |
delete(org.jnosql.diana.api.document.DocumentDeleteQuery query)
Deletes an entity
|
<T,ID> Optional<T> |
find(Class<T> entityClass,
ID id)
Finds by Id.
|
default <T> Iterable<T> |
insert(Iterable<T> entities)
Saves entity, by default it's just run for each saving using
insert(Object),
each NoSQL vendor might replace to a more appropriate one. |
default <T> Iterable<T> |
insert(Iterable<T> entities,
Duration ttl)
Saves documents collection entity with time to live, by default it's just run for each saving using
insert(Object, Duration),
each NoSQL vendor might replace to a more appropriate one. |
<T> T |
insert(T entity)
Saves entity
|
<T> T |
insert(T entity,
Duration ttl)
Saves entity with time to live
|
PreparedStatement |
prepare(String query)
Creates a
PreparedStatement from the query |
<T> List<T> |
query(String query)
Executes a query then bring the result as a
List |
<T> List<T> |
select(org.jnosql.diana.api.document.DocumentQuery query)
Finds entities from query
|
default <T> Optional<T> |
singleResult(org.jnosql.diana.api.document.DocumentQuery query)
Returns a single entity from query
|
<T> Optional<T> |
singleResult(String query)
Executes a query then bring the result as a unique result
|
default <T> Iterable<T> |
update(Iterable<T> entities)
Updates entity, by default it's just run for each saving using
update(Object),
each NoSQL vendor might replace to a more appropriate one. |
<T> T |
update(T entity)
Updates a entity
|
<T> T insert(T entity)
T - the instance typeentity - entity to be savedNullPointerException - when document is null<T> T insert(T entity,
Duration ttl)
T - the instance typeentity - entity to be savedttl - the time to liveNullPointerException - when either entity or ttl are nulldefault <T> Iterable<T> insert(Iterable<T> entities)
insert(Object),
each NoSQL vendor might replace to a more appropriate one.T - the instance typeentities - entities to be savedNullPointerException - when entities is nulldefault <T> Iterable<T> insert(Iterable<T> entities, Duration ttl)
insert(Object, Duration),
each NoSQL vendor might replace to a more appropriate one.T - the instance typeentities - entities to be savedttl - time to liveNullPointerException - when entities is null<T> T update(T entity)
T - the instance typeentity - entity to be updatedNullPointerException - when entity is nulldefault <T> Iterable<T> update(Iterable<T> entities)
update(Object),
each NoSQL vendor might replace to a more appropriate one.T - the instance typeentities - entities to be savedNullPointerException - when entities is nullvoid delete(org.jnosql.diana.api.document.DocumentDeleteQuery query)
query - query to delete an entityNullPointerException - query is null<T> List<T> select(org.jnosql.diana.api.document.DocumentQuery query)
T - the instance typequery - - query to figure out entitiesNullPointerException - when query is null<T> List<T> query(String query)
ListT - the entity typequery - the queryListNullPointerException - when the query is null<T> Optional<T> singleResult(String query)
T - the entity typequery - the queryListNullPointerException - when the query is nullorg.jnosql.diana.api.NonUniqueResultException - if returns more than one resultPreparedStatement prepare(String query)
PreparedStatement from the queryquery - the queryPreparedStatement instanceNullPointerException - when the query is null<T,ID> Optional<T> find(Class<T> entityClass, ID id)
T - the entity class typeID - the id typeentityClass - the entity classid - the id valueOptional.empty()NullPointerException - when either the entityClass or id are nullIdNotFoundException - when the entityClass does not have the Id annotation<T,ID> void delete(Class<T> entityClass, ID id)
T - the entity class typeID - the id typeentityClass - the entity classid - the id valueNullPointerException - when either the entityClass or id are nullIdNotFoundException - when the entityClass does not have the Id annotationlong count(String documentCollection)
documentCollection - the document collectionNullPointerException - when document collection is nullUnsupportedOperationException - when the database dot not have support<T> long count(Class<T> entityType)
T - entityTypeentityType - the document collectionNullPointerException - when document collection is nullUnsupportedOperationException - when the database dot not have supportdefault <T> Optional<T> singleResult(org.jnosql.diana.api.document.DocumentQuery query)
T - the instance typequery - - query to figure out entitiesOptional or Optional.empty() when the result is not found.org.jnosql.diana.api.NonUniqueResultException - when the result has more than 1 entityNullPointerException - when query is nullCopyright © 2018. All rights reserved.