Class BaseJpaRepositoryImpl<T,ID>

java.lang.Object
org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID>
io.hypersistence.utils.spring.repository.BaseJpaRepositoryImpl<T,ID>
All Implemented Interfaces:
BaseJpaRepository<T,ID>, org.springframework.data.jpa.repository.JpaRepository<T,ID>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<T>, org.springframework.data.jpa.repository.support.JpaRepositoryImplementation<T,ID>, org.springframework.data.repository.CrudRepository<T,ID>, org.springframework.data.repository.ListCrudRepository<T,ID>, org.springframework.data.repository.ListPagingAndSortingRepository<T,ID>, org.springframework.data.repository.PagingAndSortingRepository<T,ID>, org.springframework.data.repository.query.QueryByExampleExecutor<T>, org.springframework.data.repository.Repository<T,ID>

public class BaseJpaRepositoryImpl<T,ID> extends org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID> implements BaseJpaRepository<T,ID>
Author:
Vlad Mihalcea
  • Constructor Summary

    Constructors
    Constructor
    Description
    BaseJpaRepositoryImpl(org.springframework.data.jpa.repository.support.JpaEntityInformation<T,?> entityInformation, jakarta.persistence.EntityManager entityManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <R> R
    executeBatch(Supplier<R> callback)
     
    protected Integer
    getBatchSize(org.hibernate.Session session)
     
    lockById(ID id, jakarta.persistence.LockModeType lockMode)
    Lock the entity with the provided identifier.
    <S extends T>
    S
    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>
    List<S>
    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>
    List<S>
    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>
    S
    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>
    S
    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>
    List<S>
    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>
    List<S>
    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>
    S
    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.
    protected org.hibernate.Session
     
    <S extends T>
    S
    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>
    List<S>
    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>
    List<S>
    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>
    S
    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.

    Methods inherited from class org.springframework.data.jpa.repository.support.SimpleJpaRepository

    count, count, count, delete, delete, deleteAll, deleteAll, deleteAllById, deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteById, exists, exists, existsById, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAllById, findBy, findBy, findById, findOne, findOne, flush, getById, getCountQuery, getCountQuery, getDomainClass, getOne, getQuery, getQuery, getQuery, getQuery, getQueryHints, getQueryHintsForCount, getReferenceById, getRepositoryMethodMetadata, readPage, readPage, save, saveAll, saveAllAndFlush, saveAndFlush, setEscapeCharacter, setRepositoryMethodMetadata

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.hypersistence.utils.spring.repository.BaseJpaRepository

    count, delete, deleteAllByIdInBatch, deleteAllInBatch, deleteById, existsById, findAllById, findById, flush, getReferenceById

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteInBatch

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Constructor Details

    • BaseJpaRepositoryImpl

      public BaseJpaRepositoryImpl(org.springframework.data.jpa.repository.support.JpaEntityInformation<T,?> entityInformation, jakarta.persistence.EntityManager entityManager)
  • Method Details

    • persist

      @Transactional public <S extends T> S persist(S entity)
      Description copied from interface: BaseJpaRepository
      The persist method allows you to pass the provided entity to the persist method of the underlying JPA EntityManager.
      Specified by:
      persist in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to persist
      Returns:
      entity
    • persistAndFlush

      @Transactional public <S extends T> S persistAndFlush(S entity)
      Description copied from interface: BaseJpaRepository
      The persistAndFlush method allows you to pass the provided entity to the persist method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      persistAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to persist
      Returns:
      entity
    • persistAll

      @Transactional public <S extends T> List<S> persistAll(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The persistAll method allows you to pass the provided entities to the persist method of the underlying JPA EntityManager.
      Specified by:
      persistAll in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • persistAllAndFlush

      @Transactional public <S extends T> List<S> persistAllAndFlush(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The persistAll method allows you to pass the provided entities to the persist method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      persistAllAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • merge

      @Transactional public <S extends T> S merge(S entity)
      Description copied from interface: BaseJpaRepository
      The persist method allows you to pass the provided entity to the merge method of the underlying JPA EntityManager.
      Specified by:
      merge in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to merge
      Returns:
      entity
    • mergeAndFlush

      @Transactional public <S extends T> S mergeAndFlush(S entity)
      Description copied from interface: BaseJpaRepository
      The mergeAndFlush method allows you to pass the provided entity to the merge method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      mergeAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to merge
      Returns:
      entity
    • mergeAll

      @Transactional public <S extends T> List<S> mergeAll(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The mergeAll method allows you to pass the provided entities to the merge method of the underlying JPA EntityManager.
      Specified by:
      mergeAll in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to merge
      Returns:
      entities
    • mergeAllAndFlush

      @Transactional public <S extends T> List<S> mergeAllAndFlush(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The mergeAllAndFlush method allows you to pass the provided entities to the merge method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      mergeAllAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • update

      @Transactional public <S extends T> S update(S entity)
      Description copied from interface: BaseJpaRepository
      The update method allows you to pass the provided entity to the update method of the underlying JPA EntityManager.
      Specified by:
      update in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to update
      Returns:
      entity
    • updateAndFlush

      @Transactional public <S extends T> S updateAndFlush(S entity)
      Description copied from interface: BaseJpaRepository
      The updateAndFlush method allows you to pass the provided entity to the update method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      updateAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to update
      Returns:
      entity
    • updateAll

      @Transactional public <S extends T> List<S> updateAll(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The updateAll method allows you to pass the provided entities to the update method of the underlying JPA EntityManager.
      Specified by:
      updateAll in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to update
      Returns:
      entities
    • updateAllAndFlush

      @Transactional public <S extends T> List<S> updateAllAndFlush(Iterable<S> entities)
      Description copied from interface: BaseJpaRepository
      The updateAllAndFlush method allows you to pass the provided entities to the update method of the underlying JPA EntityManager and call flush afterwards.
      Specified by:
      updateAllAndFlush in interface BaseJpaRepository<T,ID>
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to update
      Returns:
      entities
    • lockById

      public T lockById(ID id, jakarta.persistence.LockModeType lockMode)
      Description copied from interface: BaseJpaRepository
      Lock the entity with the provided identifier.
      Specified by:
      lockById in interface BaseJpaRepository<T,ID>
      Parameters:
      id - entity identifier
      lockMode - entity lock mode
      Returns:
      entity
    • getBatchSize

      protected Integer getBatchSize(org.hibernate.Session session)
    • executeBatch

      protected <R> R executeBatch(Supplier<R> callback)
    • session

      protected org.hibernate.Session session()