Interface NotesRepository

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

public interface NotesRepository extends org.springframework.data.jpa.repository.JpaRepository<NotesEntity,Long>
This is NotesRepository interface. Interface for generic CRUD operations of the Notes entity. This handles the below operations.
  • Create
  • Read
  • Delete
Author:
Infosys Equinox
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Page<NotesEntity>
    findAllByUserIdOrderByIdDesc(org.springframework.data.domain.Pageable pageRequest, long userId)
    This is used to load the user notes by userId
    findByIdAndUserId(long id, long userId)
    This is used to load the notes by notes id and userId

    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

    • findAllByUserIdOrderByIdDesc

      org.springframework.data.domain.Page<NotesEntity> findAllByUserIdOrderByIdDesc(org.springframework.data.domain.Pageable pageRequest, long userId)
      This is used to load the user notes by userId
      Parameters:
      userId - Indicates the user id for which user the notes are loaded.
      pageRequest - Instance of Pageable object.
      Returns:
      The Page of NotesEntity object.
    • findByIdAndUserId

      Optional<NotesEntity> findByIdAndUserId(long id, long userId)
      This is used to load the notes by notes id and userId
      Parameters:
      id - Indicates the notes id for which the notes gets loaded.
      userId - Indicates the user id for which user the notes are loaded.
      Returns:
      The Optional of NotesEntity object.