Interface JpaStoredEventRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<StoredEvent,Long>, org.springframework.data.jpa.repository.JpaRepository<StoredEvent,Long>, org.springframework.data.repository.ListCrudRepository<StoredEvent,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<StoredEvent,Long>, org.springframework.data.repository.PagingAndSortingRepository<StoredEvent,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<StoredEvent>, Repository<StoredEvent,Long>, org.springframework.data.repository.Repository<StoredEvent,Long>, StoredEventRepository

public interface JpaStoredEventRepository extends StoredEventRepository, org.springframework.data.jpa.repository.JpaRepository<StoredEvent,Long>
A Spring Data JPA "implementation" of the StoredEventRepository interface.
Author:
RealLifeDeveloper
  • Method Summary

    Modifier and Type
    Method
    Description
    allEventsBetween(long firstStoredEventId, long lastStoredEventId)
    Gives all StoredEvents with IDs greater than or equal to firstStoredEventId and less than or equal to lastStoredEventId, i.e., all events that occurred between the events with the given IDs, inclusive.
    allEventsSince(long firstStoredEventId)
    Gives all StoredEvents with IDs greater than storedEventId, i.e., all events that occurred after the event with the given ID.
    Gives the ID of the most recently saved StoredEvent in the repository.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

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

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

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

    count, exists, findAll, findBy, findOne

    Methods inherited from interface com.reallifedeveloper.common.domain.Repository

    findById

    Methods inherited from interface com.reallifedeveloper.common.application.eventstore.StoredEventRepository

    save
  • Method Details

    • allEventsSince

      @Query("select se from StoredEvent se where se.id > :firstStoredEventId") List<StoredEvent> allEventsSince(@Param("firstStoredEventId") long firstStoredEventId)
      Description copied from interface: StoredEventRepository
      Gives all StoredEvents with IDs greater than storedEventId, i.e., all events that occurred after the event with the given ID.
      Specified by:
      allEventsSince in interface StoredEventRepository
      Parameters:
      firstStoredEventId - find all events with IDs greater than this
      Returns:
      a list of StoredEvents with IDs greater than or equal to firstStoredEventId
    • allEventsBetween

      @Query("select se from StoredEvent se where se.id between :firstStoredEventId and :lastStoredEventId") List<StoredEvent> allEventsBetween(@Param("firstStoredEventId") long firstStoredEventId, @Param("lastStoredEventId") long lastStoredEventId)
      Description copied from interface: StoredEventRepository
      Gives all StoredEvents with IDs greater than or equal to firstStoredEventId and less than or equal to lastStoredEventId, i.e., all events that occurred between the events with the given IDs, inclusive.
      Specified by:
      allEventsBetween in interface StoredEventRepository
      Parameters:
      firstStoredEventId - ID of the first StoredEvent to retrieve
      lastStoredEventId - ID of the last StoredEvent to retrieve
      Returns:
      a list of all StoredEvents with IDs between firstStoredEventId and lastStoredEventId, inclusive
    • lastStoredEventId

      @Query("select max(se.id) from StoredEvent se") Optional<Long> lastStoredEventId()
      Description copied from interface: StoredEventRepository
      Gives the ID of the most recently saved StoredEvent in the repository.
      Specified by:
      lastStoredEventId in interface StoredEventRepository
      Returns:
      the ID of the most recently saved StoredEvent unless the repository is empty