Interface JpaRepository<E,ID>

Type Parameters:
E - The entity type
ID - The ID type
All Superinterfaces:
CrudRepository<E,ID>, GenericRepository<E,ID>, PageableRepository<E,ID>

public interface JpaRepository<E,ID> extends CrudRepository<E,ID>, PageableRepository<E,ID>
Simple composed repository interface that includes CrudRepository and PageableRepository.
Since:
1.0.0
Author:
graemerocher
  • Method Summary

    Modifier and Type
    Method
    Description
    <S extends E>
    void
    detach(S entity)
    Detach the given entity from the persistence context.
    @NonNull List<E>
    Returns all instances of the type.
    @NonNull List<E>
    findAll(@NonNull Sort sort)
    Find all results for the given sort order.
    void
    Adds a flush method.
    <S extends E>
    S
    load(@NonNull Object id)
    Adds a load method.
    <S extends E>
    S
    merge(S entity)
    Merge the state of the given entity into the current persistence context.
    <S extends E>
    void
    persist(S entity)
    Persist an entity instance into the persistence context.
    <S extends E>
    void
    refresh(S entity)
    Refresh the state of the given entity from the database.
    <S extends E>
    void
    remove(S entity)
    Remove the given entity from the persistence context.
    <S extends E>
    @NonNull List<S>
    saveAll(@NonNull Iterable<S> entities)
    Saves all given entities, possibly returning new instances representing the saved state.
    <S extends E>
    S
    saveAndFlush(S entity)
    Save and perform a flush() of any pending operations.

    Methods inherited from interface io.micronaut.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save, update, updateAll

    Methods inherited from interface io.micronaut.data.repository.PageableRepository

    findAll
  • Method Details

    • saveAll

      @NonNull <S extends E> @NonNull List<S> saveAll(@NonNull @NonNull Iterable<S> entities)
      Description copied from interface: CrudRepository
      Saves all given entities, possibly returning new instances representing the saved state.
      Specified by:
      saveAll in interface CrudRepository<E,ID>
      Type Parameters:
      S - The generic type
      Parameters:
      entities - The entities to save. Must not be null.
      Returns:
      The saved entities objects. will never be null.
    • findAll

      @NonNull @NonNull List<E> findAll()
      Description copied from interface: CrudRepository
      Returns all instances of the type.
      Specified by:
      findAll in interface CrudRepository<E,ID>
      Returns:
      all entities
    • findAll

      @NonNull @NonNull List<E> findAll(@NonNull @NonNull Sort sort)
      Description copied from interface: PageableRepository
      Find all results for the given sort order.
      Specified by:
      findAll in interface PageableRepository<E,ID>
      Parameters:
      sort - The sort
      Returns:
      The iterable results
    • saveAndFlush

      @QueryHint(name="jakarta.persistence.FlushModeType", value="AUTO") <S extends E> S saveAndFlush(@NonNull S entity)
      Save and perform a flush() of any pending operations.
      Type Parameters:
      S - The entity generic type
      Parameters:
      entity - The entity
      Returns:
      The entity, possibly mutated
    • flush

      void flush()
      Adds a flush method.
    • load

      <S extends E> S load(@NonNull @NonNull Object id)
      Adds a load method.
      Type Parameters:
      S - the entity type
      Parameters:
      id - the entity ID
      Returns:
      An uninitialized proxy
    • merge

      <S extends E> S merge(@NonNull S entity)
      Merge the state of the given entity into the current persistence context.
      Type Parameters:
      S - The entity type
      Parameters:
      entity - entity instance
      Returns:
      the managed instance that the state was merged to
    • persist

      <S extends E> void persist(@NonNull S entity)
      Persist an entity instance into the persistence context.
      Type Parameters:
      S - The entity type
      Parameters:
      entity - entity instance
    • refresh

      <S extends E> void refresh(@NonNull S entity)
      Refresh the state of the given entity from the database.
      Type Parameters:
      S - The entity type
      Parameters:
      entity - entity instance
    • remove

      <S extends E> void remove(@NonNull S entity)
      Remove the given entity from the persistence context.
      Type Parameters:
      S - The entity type
      Parameters:
      entity - entity instance
    • detach

      <S extends E> void detach(@NonNull S entity)
      Detach the given entity from the persistence context.
      Type Parameters:
      S - The entity type
      Parameters:
      entity - entity instance