Interface CommentRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<CommentEntity,,Long> org.springframework.data.jpa.repository.JpaRepository<CommentEntity,,Long> org.springframework.data.repository.ListCrudRepository<CommentEntity,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<CommentEntity,,Long> org.springframework.data.repository.PagingAndSortingRepository<CommentEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<CommentEntity>,org.springframework.data.repository.Repository<CommentEntity,Long>
public interface CommentRepository
extends org.springframework.data.jpa.repository.JpaRepository<CommentEntity,Long>
JPA repository for managing comment persistence operations.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByIdAndAuthorId(Long commentId, Long authorId) Checks if a comment exists with the specified ID and author ID.findAllByPostId(Long postId) Retrieves all comments associated with a specific post.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findAllByPostId
Retrieves all comments associated with a specific post.- Parameters:
postId- the ID of the post- Returns:
- list of comments for the post
-
existsByIdAndAuthorId
Checks if a comment exists with the specified ID and author ID.- Parameters:
commentId- the ID of the commentauthorId- the ID of the author- Returns:
- true if a comment with the given ID and author exists, false otherwise
-
findById
- Specified by:
findByIdin interfaceorg.springframework.data.repository.CrudRepository<CommentEntity,Long>
-