Package io.jmix.core.repository
Interface JmixDataRepository<T,ID>
- Type Parameters:
T
- the domain type the repository managesID
- the type of the id of the entity the repository manages
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,
,ID> org.springframework.data.repository.PagingAndSortingRepository<T,
,ID> org.springframework.data.repository.Repository<T,
ID>
- All Known Implementing Classes:
JmixDataRepositoryImpl
@NoRepositoryBean
public interface JmixDataRepository<T,ID>
extends org.springframework.data.repository.PagingAndSortingRepository<T,ID>
Central Jmix data repository interface.
Extends functionality of PagingAndSortingRepository
by adding FetchPlan parameters to common methods and providing
other Jmix-specific methods
- See Also:
-
PagingAndSortingRepository
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Instantiate an entity.Returns all instances of the typeT
loaded according tofetchPlan
Returns all instances of the typeT
with the given IDs loaded according tofetchPlan
org.springframework.data.domain.Page<T>
Returns aPage
of entities meeting the paging restriction provided in thePageable
object.Returns all entities sorted by the given options and loaded by specified FetchPlan.Loads an entity by itsid
according tofetchPlan
Loads an entity by itsid
Loads an entity by itsid
according tofetchPlan
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll, findAll
-
Method Details
-
create
T create()Instantiate an entity. InvokesMetadata.create(Class)
- Returns:
- new instance of
<T>
.
-
findById
Loads an entity by itsid
according tofetchPlan
- Parameters:
id
- must not be null.- Returns:
- the entity with the given id or Optional#empty() if none found.
-
getById
Loads an entity by itsid
according tofetchPlan
- Parameters:
id
- must not be null.- Returns:
- the entity with the given id
- Throws:
IllegalStateException
- if nothing was loaded
-
getById
Loads an entity by itsid
- Parameters:
id
- must not be null.- Returns:
- the entity with the given id
- Throws:
IllegalStateException
- if nothing was loaded
-
findAll
Returns all instances of the typeT
loaded according tofetchPlan
- Returns:
- all entities
-
findAll
Returns all instances of the typeT
with the given IDs loaded according tofetchPlan
If some or all ids are not found, no entities are returned for these IDs.
- Parameters:
fetchPlan
- defines entity graph to load.FetchPlan.BASE
will be used instead in case of null.ids
- must not be null nor contain any null values.- Returns:
- guaranteed to be not null. The size can be equal or less than the number of given ids.
- Throws:
IllegalArgumentException
- in case the givenids
or one of its items is null.
-
findAll
Returns all entities sorted by the given options and loaded by specified FetchPlan.- Parameters:
fetchPlan
- to load entity.FetchPlan.BASE
will be used iffetchPlan == null
- Returns:
- all entities sorted by the given options
-
findAll
org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable, @Nullable FetchPlan fetchPlan) Returns aPage
of entities meeting the paging restriction provided in thePageable
object. Entities will be loaded according to passedfetchPlan
- Parameters:
fetchPlan
- to load entities.FetchPlan.BASE
will be used iffetchPlan == null
- Returns:
- a page of entities
-