Class HibernateRepositoryImpl<T>
java.lang.Object
io.hypersistence.utils.spring.repository.HibernateRepositoryImpl<T>
- All Implemented Interfaces:
HibernateRepository<T>
- Author:
- Vlad Mihalcea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <R> RexecuteBatch(Supplier<R> callback) findAll()The findAll method is a terrible Anti-Pattern.protected IntegergetBatchSize(org.hibernate.Session session) <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>
Ssave(S entity) The save method should be avoided.The save method should be avoided.saveAllAndFlush(Iterable<S> entities) The saveAllAndFlush method should be avoided.<S extends T>
SsaveAndFlush(S entity) The saveAndFlush method should be avoided.protected org.hibernate.Sessionsession()protected <S extends T>
S<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.
-
Constructor Details
-
HibernateRepositoryImpl
public HibernateRepositoryImpl(jakarta.persistence.EntityManager entityManager)
-
-
Method Details
-
findAll
Description copied from interface:HibernateRepositoryThe findAll method is a terrible Anti-Pattern.For more details about why you should not use the
findAllmethod by default, check out this article.- Specified by:
findAllin interfaceHibernateRepository<T>- Returns:
- all the records from the database table this entity is mapped to
-
save
Description copied from interface:HibernateRepositoryThe save method should be avoided.For more details about how to use it, check out this article.
- Specified by:
savein interfaceHibernateRepository<T>
-
saveAll
Description copied from interface:HibernateRepositoryThe save method should be avoided.For more details about how to use it, check out this article.
- Specified by:
saveAllin interfaceHibernateRepository<T>
-
saveAndFlush
Description copied from interface:HibernateRepositoryThe saveAndFlush method should be avoided.For more details about how to use it, check out this article.
- Specified by:
saveAndFlushin interfaceHibernateRepository<T>
-
saveAllAndFlush
Description copied from interface:HibernateRepositoryThe saveAllAndFlush method should be avoided.For more details about how to use it, check out this article.
- Specified by:
saveAllAndFlushin interfaceHibernateRepository<T>
-
persist
Description copied from interface:HibernateRepositoryThe persist method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManager.- Specified by:
persistin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to persist- Returns:
- entity
-
persistAndFlush
Description copied from interface:HibernateRepositoryThe persistAndFlush method allows you to pass the provided entity to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
persistAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to persist- Returns:
- entity
-
persistAll
Description copied from interface:HibernateRepositoryThe persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManager.- Specified by:
persistAllin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
persistAllAndFlush
Description copied from interface:HibernateRepositoryThe persistAll method allows you to pass the provided entities to thepersistmethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
persistAllAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
merge
Description copied from interface:HibernateRepositoryThe persist method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManager.- Specified by:
mergein interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to merge- Returns:
- entity
-
mergeAndFlush
Description copied from interface:HibernateRepositoryThe mergeAndFlush method allows you to pass the provided entity to themergemethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
mergeAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to merge- Returns:
- entity
-
mergeAll
Description copied from interface:HibernateRepositoryThe mergeAll method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManager.- Specified by:
mergeAllin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to merge- Returns:
- entities
-
mergeAllAndFlush
Description copied from interface:HibernateRepositoryThe mergeAllAndFlush method allows you to pass the provided entities to themergemethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
mergeAllAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to persist- Returns:
- entities
-
update
Description copied from interface:HibernateRepositoryThe update method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManager.- Specified by:
updatein interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to update- Returns:
- entity
-
updateAndFlush
Description copied from interface:HibernateRepositoryThe updateAndFlush method allows you to pass the provided entity to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
updateAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entity- entity to update- Returns:
- entity
-
updateAll
Description copied from interface:HibernateRepositoryThe updateAll method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManager.- Specified by:
updateAllin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to update- Returns:
- entities
-
updateAllAndFlush
Description copied from interface:HibernateRepositoryThe updateAllAndFlush method allows you to pass the provided entities to theupdatemethod of the underlying JPAEntityManagerand callflushafterwards.- Specified by:
updateAllAndFlushin interfaceHibernateRepository<T>- Type Parameters:
S- entity type- Parameters:
entities- entities to update- Returns:
- entities
-
getBatchSize
-
executeBatch
-
session
protected org.hibernate.Session session() -
unsupportedSave
-