Interface MessageRepository

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

public interface MessageRepository extends org.springframework.data.jpa.repository.JpaRepository<Message,Long>
Repository interface for accessing and managing Message entities.

This interface extends JpaRepository, providing standard CRUD operations, pagination, and query method execution for Message entities.

In addition to the inherited methods, it declares a custom finder:

The query method name follows the Spring Data JPA naming conventions and will be automatically implemented by Spring at runtime.

Author:
Nadiyar
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves all Message entities ordered by their sentAt timestamp in ascending order.

    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
  • Method Details

    • findAllByOrderBySentAtAsc

      List<Message> findAllByOrderBySentAtAsc()
      Retrieves all Message entities ordered by their sentAt timestamp in ascending order.

      This method uses Spring Data JPA's derived query mechanism and does not require a custom JPQL query.

      Returns:
      a list of messages sorted from the earliest to the latest by sentAt.