Questions tagged [pageable]

104 questions
20
votes
2 answers

How to create unpaged but sorted Pageable.of(unpaged, unpaged, Sort ) to spring data jpa repository?

How do I pass a Pageable object to Spring JPA Repository with only Sorting information? I want something like this: Pageable pageable = PageRequest.of(null, null, Sort()); I know it takes int as page and size but if we can somehow not use those…
Mohammed Idris
  • 768
  • 2
  • 9
  • 26
5
votes
1 answer

Mockito - Kotlin test throws Null Pointer Exception when trying to capture Pageable argument

I have written a really simple test for a method in my controller using Mockito @Test fun `get items based on category ID`() { val pageable: Pageable = PageRequest.of(5, 50) controller.get(10, pageable) val captor =…
Nick Div
  • 5,338
  • 12
  • 65
  • 127
4
votes
0 answers

Named query with a Pageable parameter

LOG.warn("Finder method {} is backed by a NamedQuery but contains a Pageable parameter! Sorting delivered this Pageable will not be applied!", method) I'm getting the warning above. What is the reason of the warn?
gfg007
  • 171
  • 8
3
votes
1 answer

Memory leak with Criteria API Pageable

I implemented pageable functionality into Criteria API query and I noticed increased memory usage during query execution. I also used spring-data-jpa method query to return same result, but there memory is cleaned up after every batch is processed.…
3
votes
1 answer

Can we use HINT_FETCH_SIZE and Pageable together in JPA query

I have a query like below in my JpaRepository. I have the Pageable size as 1000 records, but HINT_FETCH_SIZE as 50. Does this mean to fill the Page of 1000 records, this query is called 20 times (20 x fetch size 50)? Is my understanding…
SPagadala
  • 217
  • 3
  • 12
3
votes
2 answers

Fetch and delete the object using pageable in spring boot

I have a method called getAllEmployees() which returns a pageable. Lets say the page size is 1 and started with page 0 Pageable pageable = PageRequest.of(0, 1); Page allEmployees = service.getAllEmployeeNames(pageable) while(true) { …
Cork Kochi
  • 1,783
  • 6
  • 29
  • 45
3
votes
3 answers

Spring JPA - How to create a Pageable with a NativeQuery?

I try to do the following inside a Spring Boot application : create a native query and page it so it can returns a page of a given number of elements from a @RestController. Here's the snippet of my code, where em is the @PersistanceContext…
Sooron
  • 123
  • 1
  • 2
  • 8
3
votes
3 answers

multiple requestparam in springboot pageable

i know that this question may be duplicated but i tried a lot with no success I need to make multiple RequestParam in spring boot rest controller as following : @GetMapping("/prd-products/test") @Timed public ResponseEntity>…
2
votes
1 answer

Specify complex sorting criteria when requesting Spring Data JPA repository

I'm requesting paged and sorted data from my database, specified via Pageable with following repository API: org.springframework.data.jpa.repository.JpaSpecificationExecutor.findAll(Specification filter, Pageable pageable) Pageable…
PAX
  • 1,056
  • 15
  • 33
2
votes
3 answers

Spring pageable sort on other entity's nullable attribute

I came across the following problem... I have three entities: @Entity class Contract { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @ManyToOne private Employee employee; } @Entity class Employee…
wojtek1902
  • 503
  • 2
  • 10
  • 25
2
votes
2 answers

In back end (java spring boot) sorting, how to sort with Alias name using pageable? Without parent table as prefix

I am using backend pagination and sorting with java spring boot pageable. While passing sort field as usercount (This gives count of user_role_mapping), Java triggering an error column f.usercount does not exist . Actually usercount not a column…
Anees Hassan
  • 88
  • 1
  • 7
2
votes
1 answer

How to define direction in request with pageable parameter?

I have a query that takes pageable as a parameter. I define the direction as DESC but this takes no effect. This is my request. Could you please help me formulate the requests in a way that the results come back sorted in descending order? I have…
C96
  • 477
  • 8
  • 33
1
vote
0 answers

How to use Spring Data Pageable to query two repositories

How can I use Spring Data JPA to find results in two repositories using Pageable? Consider that we have 2 repositories: the first repository has 5 rows matching a certain condition. The second repository has 12 rows matching the condition. Sending a…
1
vote
1 answer

Can one get repeated results on an unsorted page?

if I request for a Page of results from my DB without any ordering provided val page1 = repository.findAll(PageRequest.of(1,10)) val page2 = repository.findAll(PageRequest.of(2,10)) Could page1 and page2 contain the same elements since I didn't…
edu
  • 428
  • 2
  • 10
1
vote
1 answer

Passing Spring pageable in get request

If I send a request from Spring application: public ResponseEntity> readDocs( Pageable pageable ) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.add("Authorization", getToken()); String…
tryingHard
  • 1,794
  • 4
  • 35
  • 74
1
2 3 4 5 6 7