Package com.patreonshout.jpa
Interface ListPostsRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ListPost,java.lang.Integer>
,org.springframework.data.jpa.repository.JpaRepository<ListPost,java.lang.Integer>
,org.springframework.data.repository.PagingAndSortingRepository<ListPost,java.lang.Integer>
,org.springframework.data.repository.query.QueryByExampleExecutor<ListPost>
,org.springframework.data.repository.Repository<ListPost,java.lang.Integer>
@Transactional public interface ListPostsRepository extends org.springframework.data.jpa.repository.JpaRepository<ListPost,java.lang.Integer>
Spring Data Repository for easy use of CRUD operations on the
PostBean
object-
Method Summary
Modifier and Type Method Description void
deleteByListAndPost(int list_id, int post_id)
Deletes aListPost
in the database by it's list_id and post_idjava.util.List<ListPost>
findAllByListId(int listId)
Finds all the posts in a list by it's list_idjava.util.List<ListPost>
findAllByPostId(int post_id)
Finds all the posts in any list by it's post_idMethods 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, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlush
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
-
deleteByListAndPost
@Modifying @Query(value="DELETE FROM list_posts WHERE list_id = ?1 AND post_id = ?2", nativeQuery=true) void deleteByListAndPost(int list_id, int post_id)Deletes aListPost
in the database by it's list_id and post_id- Parameters:
list_id
- the id of the listpost_id
- the id of the post
-
findAllByListId
Finds all the posts in a list by it's list_id- Parameters:
listId
- the id of the list we want to find the posts of- Returns:
- a list of
ListPost
-
findAllByPostId
Finds all the posts in any list by it's post_id- Parameters:
post_id
- is the id of a post- Returns:
- a list of
ListPost
-