Interface CrudRepository<E,K>


public interface CrudRepository<E,K>
Base contract for generated repositories. The caller owns the Session and transaction. save returns the managed merge result; insert schedules a new instance for persistence.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
     
    void
    delete(E entity)
    Deletes one entity, managed or detached, as Spring Data's delete does: a detached instance is merged first, so the row it stands for is removed.
    void
    Deletes every entity of this type, one by one, so cascades and lifecycle callbacks run as they do for delete.
    void
    deleteAll(Iterable<? extends E> entities)
    Deletes each of the given entities, as delete does.
    void
     
    boolean
     
     
    The entities whose ids are given, in the order given; an id with no row is skipped, so the list can be shorter than the input.
    findById(K id)
     
    void
    Writes pending changes of the caller's session now, rather than at commit.
    void
    insert(E entity)
     
    save(E entity)
     
    saveAll(Iterable<? extends E> entities)
    Saves each of the given entities, as save does, and answers the managed results in the same order.
  • Method Details

    • findById

      E findById(K id)
    • save

      E save(E entity)
    • insert

      void insert(E entity)
    • deleteById

      void deleteById(K id)
    • findAll

      List<E> findAll()
    • count

      long count()
    • existsById

      boolean existsById(K id)
    • delete

      void delete(E entity)
      Deletes one entity, managed or detached, as Spring Data's delete does: a detached instance is merged first, so the row it stands for is removed. An entity whose row no longer exists is ignored. Requires a transaction.
    • deleteAll

      void deleteAll()
      Deletes every entity of this type, one by one, so cascades and lifecycle callbacks run as they do for delete. Requires a transaction.
    • deleteAll

      void deleteAll(Iterable<? extends E> entities)
      Deletes each of the given entities, as delete does. Requires a transaction.
    • saveAll

      List<E> saveAll(Iterable<? extends E> entities)
      Saves each of the given entities, as save does, and answers the managed results in the same order.
    • findAllById

      List<E> findAllById(Iterable<K> ids)
      The entities whose ids are given, in the order given; an id with no row is skipped, so the list can be shorter than the input.
    • flush

      void flush()
      Writes pending changes of the caller's session now, rather than at commit.