public class HibernateRepositoryImpl<T> extends Object implements HibernateRepository<T>
Constructor and Description |
---|
HibernateRepositoryImpl(javax.persistence.EntityManager entityManager) |
Modifier and Type | Method and Description |
---|---|
protected <R> R |
executeBatch(Supplier<R> callback) |
List<T> |
findAll()
The findAll method is a terrible Anti-Pattern.
|
protected Integer |
getBatchSize(org.hibernate.Session session) |
<S extends T> |
merge(S entity)
The persist method allows you to pass the provided entity to the
merge method of the
underlying JPA EntityManager . |
<S extends T> |
mergeAll(Iterable<S> entities)
The mergeAll method allows you to pass the provided entities to the
merge method of the
underlying JPA EntityManager . |
<S extends T> |
mergeAllAndFlush(Iterable<S> entities)
The mergeAllAndFlush method allows you to pass the provided entities to the
merge method of the
underlying JPA EntityManager and call flush afterwards. |
<S extends T> |
mergeAndFlush(S entity)
The mergeAndFlush method allows you to pass the provided entity to the
merge method of the
underlying JPA EntityManager and call flush afterwards. |
<S extends T> |
persist(S entity)
The persist method allows you to pass the provided entity to the
persist method of the
underlying JPA EntityManager . |
<S extends T> |
persistAll(Iterable<S> entities)
The persistAll method allows you to pass the provided entities to the
persist method of the
underlying JPA EntityManager . |
<S extends T> |
persistAllAndFlush(Iterable<S> entities)
The persistAll method allows you to pass the provided entities to the
persist method of the
underlying JPA EntityManager and call flush afterwards. |
<S extends T> |
persistAndFlush(S entity)
The persistAndFlush method allows you to pass the provided entity to the
persist method of the
underlying JPA EntityManager and call flush afterwards. |
<S extends T> |
save(S entity)
The save method should be avoided.
|
<S extends T> |
saveAll(Iterable<S> entities)
The save method should be avoided.
|
<S extends T> |
saveAllAndFlush(Iterable<S> entities)
The saveAllAndFlush method should be avoided.
|
<S extends T> |
saveAndFlush(S entity)
The saveAndFlush method should be avoided.
|
protected org.hibernate.Session |
session() |
protected <S extends T> |
unsupportedSave() |
<S extends T> |
update(S entity)
The update method allows you to pass the provided entity to the
update method of the
underlying JPA EntityManager . |
<S extends T> |
updateAll(Iterable<S> entities)
The updateAll method allows you to pass the provided entities to the
update method of the
underlying JPA EntityManager . |
<S extends T> |
updateAllAndFlush(Iterable<S> entities)
The updateAllAndFlush method allows you to pass the provided entities to the
update method of the
underlying JPA EntityManager and call flush afterwards. |
<S extends T> |
updateAndFlush(S entity)
The updateAndFlush method allows you to pass the provided entity to the
update method of the
underlying JPA EntityManager and call flush afterwards. |
public HibernateRepositoryImpl(javax.persistence.EntityManager entityManager)
public List<T> findAll()
HibernateRepository
For more details about why you should not use the findAll
method by default,
check out this article.
findAll
in interface HibernateRepository<T>
public <S extends T> S save(S entity)
HibernateRepository
For more details about how to use it, check out this article.
save
in interface HibernateRepository<T>
public <S extends T> List<S> saveAll(Iterable<S> entities)
HibernateRepository
For more details about how to use it, check out this article.
saveAll
in interface HibernateRepository<T>
public <S extends T> S saveAndFlush(S entity)
HibernateRepository
For more details about how to use it, check out this article.
saveAndFlush
in interface HibernateRepository<T>
public <S extends T> List<S> saveAllAndFlush(Iterable<S> entities)
HibernateRepository
For more details about how to use it, check out this article.
saveAllAndFlush
in interface HibernateRepository<T>
public <S extends T> S persist(S entity)
HibernateRepository
persist
method of the
underlying JPA EntityManager
.persist
in interface HibernateRepository<T>
S
- entity typeentity
- entity to persistpublic <S extends T> S persistAndFlush(S entity)
HibernateRepository
persist
method of the
underlying JPA EntityManager
and call flush
afterwards.persistAndFlush
in interface HibernateRepository<T>
S
- entity typeentity
- entity to persistpublic <S extends T> List<S> persistAll(Iterable<S> entities)
HibernateRepository
persist
method of the
underlying JPA EntityManager
.persistAll
in interface HibernateRepository<T>
S
- entity typeentities
- entities to persistpublic <S extends T> List<S> persistAllAndFlush(Iterable<S> entities)
HibernateRepository
persist
method of the
underlying JPA EntityManager
and call flush
afterwards.persistAllAndFlush
in interface HibernateRepository<T>
S
- entity typeentities
- entities to persistpublic <S extends T> S merge(S entity)
HibernateRepository
merge
method of the
underlying JPA EntityManager
.merge
in interface HibernateRepository<T>
S
- entity typeentity
- entity to mergepublic <S extends T> S mergeAndFlush(S entity)
HibernateRepository
merge
method of the
underlying JPA EntityManager
and call flush
afterwards.mergeAndFlush
in interface HibernateRepository<T>
S
- entity typeentity
- entity to mergepublic <S extends T> List<S> mergeAll(Iterable<S> entities)
HibernateRepository
merge
method of the
underlying JPA EntityManager
.mergeAll
in interface HibernateRepository<T>
S
- entity typeentities
- entities to mergepublic <S extends T> List<S> mergeAllAndFlush(Iterable<S> entities)
HibernateRepository
merge
method of the
underlying JPA EntityManager
and call flush
afterwards.mergeAllAndFlush
in interface HibernateRepository<T>
S
- entity typeentities
- entities to persistpublic <S extends T> S update(S entity)
HibernateRepository
update
method of the
underlying JPA EntityManager
.update
in interface HibernateRepository<T>
S
- entity typeentity
- entity to updatepublic <S extends T> S updateAndFlush(S entity)
HibernateRepository
update
method of the
underlying JPA EntityManager
and call flush
afterwards.updateAndFlush
in interface HibernateRepository<T>
S
- entity typeentity
- entity to updatepublic <S extends T> List<S> updateAll(Iterable<S> entities)
HibernateRepository
update
method of the
underlying JPA EntityManager
.updateAll
in interface HibernateRepository<T>
S
- entity typeentities
- entities to updatepublic <S extends T> List<S> updateAllAndFlush(Iterable<S> entities)
HibernateRepository
update
method of the
underlying JPA EntityManager
and call flush
afterwards.updateAllAndFlush
in interface HibernateRepository<T>
S
- entity typeentities
- entities to updateprotected Integer getBatchSize(org.hibernate.Session session)
protected <R> R executeBatch(Supplier<R> callback)
protected org.hibernate.Session session()
protected <S extends T> S unsupportedSave()
Copyright © 2024. All rights reserved.