Interface HibernateRepository<T>

All Known Implementing Classes:
HibernateRepositoryImpl

public interface HibernateRepository<T>
The HibernateRepository fixes the problems that the default Spring Data JpaRepository suffers from.

For more details about how to use it, check out this article.

Version:
2.17.0
Author:
Vlad Mihalcea
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    <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.
    <S extends T>
    S
    save(S entity)
    Deprecated.
    <S extends T>
    List<S>
    saveAll(Iterable<S> entities)
    Deprecated.
    <S extends T>
    List<S>
    Deprecated.
    <S extends T>
    S
    saveAndFlush(S entity)
    Deprecated.
    <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.
  • Method Details

    • findAll

      @Deprecated List<T> findAll()
      Deprecated.
      The findAll method is a terrible Anti-Pattern.

      For more details about why you should not use the findAll method by default, check out this article.

      Returns:
      all the records from the database table this entity is mapped to
    • save

      @Deprecated <S extends T> S save(S entity)
      Deprecated.
      The save method should be avoided.

      For more details about how to use it, check out this article.

    • saveAll

      @Deprecated <S extends T> List<S> saveAll(Iterable<S> entities)
      Deprecated.
      The save method should be avoided.

      For more details about how to use it, check out this article.

    • saveAndFlush

      @Deprecated <S extends T> S saveAndFlush(S entity)
      Deprecated.
      The saveAndFlush method should be avoided.

      For more details about how to use it, check out this article.

    • saveAllAndFlush

      @Deprecated <S extends T> List<S> saveAllAndFlush(Iterable<S> entities)
      Deprecated.
      The saveAllAndFlush method should be avoided.

      For more details about how to use it, check out this article.

    • persist

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to persist
      Returns:
      entity
    • persistAndFlush

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to persist
      Returns:
      entity
    • persistAll

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • persistAllAndFlush

      <S extends T> List<S> 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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • merge

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to merge
      Returns:
      entity
    • mergeAndFlush

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to merge
      Returns:
      entity
    • mergeAll

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to merge
      Returns:
      entities
    • mergeAllAndFlush

      <S extends T> List<S> 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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to persist
      Returns:
      entities
    • update

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to update
      Returns:
      entity
    • updateAndFlush

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entity - entity to update
      Returns:
      entity
    • updateAll

      <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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to update
      Returns:
      entities
    • updateAllAndFlush

      <S extends T> List<S> 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.
      Type Parameters:
      S - entity type
      Parameters:
      entities - entities to update
      Returns:
      entities