Interface BaseJpaRepository<T,ID>
- All Superinterfaces:
org.springframework.data.repository.query.QueryByExampleExecutor<T>,org.springframework.data.repository.Repository<T,ID>
- All Known Implementing Classes:
BaseJpaRepositoryImpl
@NoRepositoryBean
public interface BaseJpaRepository<T,ID>
extends org.springframework.data.repository.Repository<T,ID>, org.springframework.data.repository.query.QueryByExampleExecutor<T>
The
BaseJpaRepository fixes many of the problems that the default Spring Data JpaRepository
suffers from.
For more details about how to use it, check out this article on vladmihalcea.com.
- Version:
- 2.21.0
- Author:
- Vlad Mihalcea
-
Method Summary
Modifier and TypeMethodDescriptionlongcount()voidvoiddeleteAllByIdInBatch(Iterable<ID> ids) voiddeleteAllInBatch(Iterable<T> entities) voiddeleteById(ID id) booleanexistsById(ID id) findAllById(Iterable<ID> ids) voidflush()getReferenceById(ID id) Lock the entity with the provided identifier.<S extends T>
Smerge(S entity) The persist method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManager.The mergeAll method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManager.mergeAllAndFlush(Iterable<S> entities) The mergeAllAndFlush method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManagerand callflushafterwards.<S extends T>
SmergeAndFlush(S entity) The mergeAndFlush method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManagerand callflushafterwards.<S extends T>
Spersist(S entity) The persist method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManager.persistAll(Iterable<S> entities) The persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManager.persistAllAndFlush(Iterable<S> entities) The persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.<S extends T>
SpersistAndFlush(S entity) The persistAndFlush method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.<S extends T>
Supdate(S entity) The update method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManager.The updateAll method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManager.updateAllAndFlush(Iterable<S> entities) The updateAllAndFlush method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.<S extends T>
SupdateAndFlush(S entity) The updateAndFlush method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findAll, findAll, findBy, findOne
-
Method Details
-
findById
-
existsById
-
getReferenceById
-
findAllById
-
count
long count() -
delete
-
deleteAllInBatch
-
deleteById
-
deleteAllByIdInBatch
-
flush
void flush() -
persist
The persist method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entity- entity to persist- Returns:
- entity
-
persistAndFlush
The persistAndFlush method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entity- entity to persist- Returns:
- entity
-
persistAll
The persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
persistAllAndFlush
The persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
merge
The persist method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entity- entity to merge- Returns:
- entity
-
mergeAndFlush
The mergeAndFlush method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entity- entity to merge- Returns:
- entity
-
mergeAll
The mergeAll method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entities- entities to merge- Returns:
- entities
-
mergeAllAndFlush
The mergeAllAndFlush method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
update
The update method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entity- entity to update- Returns:
- entity
-
updateAndFlush
The updateAndFlush method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entity- entity to update- Returns:
- entity
-
updateAll
The updateAll method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManager.- Type Parameters:
S- entity type- Parameters:
entities- entities to update- Returns:
- entities
-
updateAllAndFlush
The updateAllAndFlush method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.- Type Parameters:
S- entity type- Parameters:
entities- entities to update- Returns:
- entities
-
lockById
Lock the entity with the provided identifier.- Parameters:
id- entity identifierlockMode- entity lock mode- Returns:
- entity
-