1
1
package org .jnosql .demoee ;
2
2
3
- import jakarta .data .page .Pageable ;
3
+ import jakarta .data .Order ;
4
+ import jakarta .data .page .PageRequest ;
4
5
import jakarta .enterprise .context .ApplicationScoped ;
5
6
import jakarta .inject .Inject ;
6
7
@@ -36,12 +37,12 @@ public AuthorWithBooks save(AuthorWithBooks author) {
36
37
return author ;
37
38
}
38
39
39
- public Stream <AuthorWithBooks > findAuthorsByName (String name , Pageable pageable ) {
40
+ public Stream <AuthorWithBooks > findAuthorsByName (String name , PageRequest pageable ) {
40
41
return authorWithBooksRepository .findByName (name , pageable );
41
42
}
42
43
43
- public Stream <AuthorWithBooks > listAuthors (Pageable pageable ) {
44
- return authorWithBooksRepository .findAll (pageable ).stream ();
44
+ public Stream <AuthorWithBooks > listAuthors (PageRequest pageable ) {
45
+ return authorWithBooksRepository .findAll (pageable , Order . by () ).stream ();
45
46
}
46
47
47
48
public Optional <AuthorWithBooks > findAuthorById (String authorId ) {
@@ -58,11 +59,11 @@ public BookWithAuthor save(BookWithAuthor bookWithAuthor) {
58
59
return bookWithAuthor ;
59
60
}
60
61
61
- public Stream <BookWithAuthor > findBooksByTitle (String title , Pageable pageable ) {
62
+ public Stream <BookWithAuthor > findBooksByTitle (String title , PageRequest pageable ) {
62
63
return bookWithAuthorRepository .findByTitleLike (title , pageable );
63
64
}
64
65
65
- public Stream <BookWithAuthor > listBooks (Pageable pageable ) {
66
- return bookWithAuthorRepository .findAll (pageable ).stream ();
66
+ public Stream <BookWithAuthor > listBooks (PageRequest pageable ) {
67
+ return bookWithAuthorRepository .findAll (pageable , Order . by () ).stream ();
67
68
}
68
69
}
0 commit comments