Class BookRepository
java.lang.Object
io.micronaut.data.tck.repositories.BookRepository
- All Implemented Interfaces:
CrudRepository<Book,,Long> GenericRepository<Book,,Long> JpaSpecificationExecutor<Book>,PageableRepository<Book,,Long> SimpleBookRepository
public abstract class BookRepository
extends Object
implements PageableRepository<Book,Long>, JpaSpecificationExecutor<Book>, SimpleBookRepository
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intabstract intabstract intdeleteByAuthor(Author author) abstract intdeleteByIdAndAuthorId(Long id, Long authorId) abstract voidFinds all records for the given pageable.findAll(@Nullable PredicateSpecification<Book> spec) Returns all entities matching the givenPredicateSpecification.findAll(PredicateSpecification<Book> spec, Pageable pageable) Returns aPageof entities matching the givenQuerySpecification.findAllByChaptersTitle(String chapterTitle) findAllByChaptersTitleAndTitle(String chapterTitle, String title) findAllByGenre(Genre genre) findAllByStudentsNameIn(List<String> names, Pageable pageable) findAllSorted(Pageable pageable) findAllSorted2(Pageable pageable) abstract AuthorfindAuthorById(Long id) findBooks(int limit, int offset) findBooksByTotalPages(int totalPages, Pageable pageable) findByAuthorIds(List<Long> authorIds) findByAuthorInList(List<Author> authors) findByAuthorName(String name) findByAuthors(List<Author> authors) abstract BookfindByTitle(String title) abstract BookfindByTitleOrAuthorAndId(String title, Author author, Long id) findByTotalPagesGreaterThan(int totalPages, Pageable pageable) findOne(@Nullable PredicateSpecification<Book> spec) Returns a single entity matching the givenPredicateSpecification.listNativeBooks(String arg0) listNativeBooksNullableArrayAsStringArray(@Nullable String[] arg0) listNativeBooksNullableListAsStringArray(@Nullable List<String> arg0) listNativeBooksWithTitleAnyArray(@Nullable String[] arg0) listNativeBooksWithTitleAnyCollection(@Nullable Collection<String> arg0) listNativeBooksWithTitleInArray(@Nullable String[] arg0) listNativeBooksWithTitleInCollection(@Nullable Collection<String> arg0) listPageableCustomQuery(Pageable pageable) protected Authorprotected Bookabstract BookqueryByTitle(String title) abstract @NonNull BookSaves the given valid entity, returning a possibly new entity representing the saved state.abstract BookvoidsaveAuthorBooks(List<AuthorBooksDto> authorBooksDtos) abstract longupdateAuthor(Long id, Author author) abstract longupdateAuthorCustom(Long id, Author author) abstract voidupdateByIdInList(List<Long> id, String title) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findAll, findById, saveAll, update, updateAllMethods inherited from interface io.micronaut.data.repository.jpa.JpaSpecificationExecutor
count, count, deleteAll, deleteAll, deleteAll, exists, exists, findAll, findAll, findAll, findAll, findAll, findOne, findOne, updateAll, updateAllMethods inherited from interface io.micronaut.data.repository.PageableRepository
findAllMethods inherited from interface io.micronaut.data.tck.repositories.SimpleBookRepository
count, deleteAll
-
Field Details
-
authorRepository
-
-
Constructor Details
-
BookRepository
-
-
Method Details
-
findAll
Description copied from interface:JpaSpecificationExecutorReturns aPageof entities matching the givenQuerySpecification.- Specified by:
findAllin interfaceJpaSpecificationExecutor<Book>- Parameters:
spec- The query specificationpageable- The pageable object- Returns:
- a page
-
findAllByStudentsNameIn
-
save
Description copied from interface:CrudRepositorySaves the given valid entity, returning a possibly new entity representing the saved state. Note that certain implementations may not be able to detect whether a save or update should be performed and may always perform an insert. TheCrudRepository.update(Object)method can be used in this case to explicitly request an update.- Specified by:
savein interfaceCrudRepository<Book,Long> - Specified by:
savein interfaceSimpleBookRepository- Parameters:
book- The entity to save. Must not be null.- Returns:
- The saved entity will never be null.
-
findBooks
-
queryByTitle
-
listPageableCustomQuery
-
findAll
Description copied from interface:PageableRepositoryFinds all records for the given pageable.- Specified by:
findAllin interfacePageableRepository<Book,Long> - Parameters:
pageable- The pageable.- Returns:
- The results
-
findAllSorted
-
findAllSorted2
-
findByTotalPagesGreaterThan
-
findAllByTitleStartingWith
-
findByAuthorIsNull
-
findByAuthorIsNotNull
-
countByTitleIsEmpty
public abstract int countByTitleIsEmpty() -
countByTitleIsNotEmpty
public abstract int countByTitleIsNotEmpty() -
findByAuthorName
-
findTop3OrderByTitle
-
findTop3ByAuthorNameOrderByTitle
-
queryTop3ByAuthorNameOrderByTitle
-
deleteByTitleIsEmptyOrTitleIsNull
public abstract void deleteByTitleIsEmptyOrTitleIsNull() -
findByTitle
-
findAuthorById
-
listNativeBooks
-
listNativeBooksWithTitleInCollection
@Query(value="select * from book b where b.title in (:arg0)", nativeQuery=true) public abstract List<Book> listNativeBooksWithTitleInCollection(@Nullable @Nullable Collection<String> arg0) -
listNativeBooksWithTitleInArray
@Query(value="select * from book b where b.title IN (:arg0)", nativeQuery=true) public abstract List<Book> listNativeBooksWithTitleInArray(@Expandable @TypeDef(type=STRING) @Nullable @Nullable String[] arg0) -
listNativeBooksWithTitleAnyCollection
@Query(value="select * from book b where b.title = any (:arg0)", nativeQuery=true) public abstract List<Book> listNativeBooksWithTitleAnyCollection(@Nullable @Nullable Collection<String> arg0) -
listNativeBooksWithTitleAnyArray
-
listNativeBooksNullableListAsStringArray
@Query(value="select * from book where (CASE WHEN exists ( select (:arg0) ) THEN title = ANY (:arg0) ELSE true END)", nativeQuery=true) public abstract List<Book> listNativeBooksNullableListAsStringArray(@Nullable @TypeDef(type=STRING_ARRAY) @Nullable List<String> arg0) -
listNativeBooksNullableArrayAsStringArray
@Query(value="select * from book where (CASE WHEN exists ( select (:arg0) ) THEN title = ANY (:arg0) ELSE true END)", nativeQuery=true) public abstract List<Book> listNativeBooksNullableArrayAsStringArray(@Nullable @TypeDef(type=STRING_ARRAY) @Nullable String[] arg0) -
updateAuthorCustom
-
updateAuthor
-
updateByIdInList
-
saveAuthorBooks
-
newAuthor
-
newBook
-
deleteByIdAndAuthorId
-
save
-
deleteByAuthor
-
findAllByGenre
-
findOne
Description copied from interface:JpaSpecificationExecutorReturns a single entity matching the givenPredicateSpecification.- Specified by:
findOnein interfaceJpaSpecificationExecutor<Book>- Parameters:
spec- The query specification- Returns:
- optional found result
-
findAll
Description copied from interface:JpaSpecificationExecutorReturns all entities matching the givenPredicateSpecification.- Specified by:
findAllin interfaceJpaSpecificationExecutor<Book>- Parameters:
spec- The query specification- Returns:
- found results
-
findAllByCriteria
-
findByTitleOrAuthorAndId
-
findAllByChaptersTitle
-
findAllByChaptersTitleAndTitle
-
findByAuthors
-
findByAuthorIds
-
findByAuthorInList
-
findBooksByTotalPages
@Query(value="SELECT * FROM book WHERE total_pages = :totalPages", countQuery="SELECT COUNT(*) FROM book WHERE total_pages = :totalPages", nativeQuery=true) public abstract Page<Book> findBooksByTotalPages(int totalPages, Pageable pageable)
-