T - the bean typeK - the K typepublic interface Repository<T,K>
Interface to generic CRUD operations on a repository for a specific type.
The interface that extends need to be recovered by CDI, so either the bean-discovery-mode="all" be set in bean.xml or define a scope in the interface.
https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#default_bean_discovery
The query builder mechanism built into Jakarta NoSQL Mapping repository infrastructure is useful for building constraining queries over entities of the repository. The mechanism strips the prefixes is defined by:findBy: to select any information T
deleteBy: To delete any information T
Jakarta NoSQL Mapping has some keywords on method:And
Or
Between
LessThan
GreaterThan
LessThanEqual
GreaterThanEqual
Like
In
OrderBy
OrderBy____Desc
OrderBy_____ASC
| Modifier and Type | Method and Description |
|---|---|
long |
count()
Returns the number of entities available.
|
void |
deleteById(Iterable<K> ids)
Deletes the entity with the given ids.
|
void |
deleteById(K id)
Deletes the entity with the given id.
|
boolean |
existsById(K id)
Returns whether an entity with the given id exists.
|
Iterable<T> |
findById(Iterable<K> ids)
Finds the entities given ids
|
Optional<T> |
findById(K id)
Finds an entity given the id
|
<S extends T> |
save(Iterable<S> entities)
Saves entity
each NoSQL vendor might replace to a more appropriate one.
|
<S extends T> |
save(S entity)
Saves entity
|
<S extends T> S save(S entity)
S - the entity typeentity - entity to be savedNullPointerException - when document is null<S extends T> Iterable<S> save(Iterable<S> entities)
S - the entity typeentities - entities to be savedNullPointerException - when entities is nullvoid deleteById(K id)
id - the idNullPointerException - when id is nullvoid deleteById(Iterable<K> ids)
ids - the idsNullPointerException - when either ids or same element is nullOptional<T> findById(K id)
id - the idNullPointerException - when id is nullIterable<T> findById(Iterable<K> ids)
ids - the idsNullPointerException - when the id is nullboolean existsById(K id)
id - the idNullPointerException - when id is nulllong count()
Copyright © 2017–2021 Eclipse Foundation. All rights reserved.