Questions tagged [pageable]

104 questions
0
votes
0 answers

How to format a Pageable json object in javascript sending direction of query to Spring API

I want to send as a part of a Pageable object the direction/order of a query "ASC" or "DESC". So my problem is that even if I set the direction as value of pageable and the API URL Request has this information in it, the Spring backend does not…
0
votes
1 answer

How to remove/handle irrelevant or bad sort parameters from http url using Pageable interface in spring boot?

How to remove/handle irrelevant or bad sort parameters from http url using Pageable interface in spring boot? For e.g. I have a query like http://localhost:8080/all?sort=firstName,asc&sort=nosuchfield,asc How can I handle or remove the irrelevant…
0
votes
2 answers

I using @Query and Pageable has error: Variables are only allowed when ordering by an expression referencing a column name

I tried to query: @Query(value = "SELECT * FROM BookingOffice WHERE tripId in (select Trip.tripId from Trip Where Trip.desfination like ?#{#desfination}) ORDER BY ?#{#pageable}", countQuery = "SELECT COUNT(*) FROM BookingOffice WHERE tripId…
TiNET
  • 3
  • 3
0
votes
0 answers

How do I solve this simple but unsolved JPA pagination problem?

I am trying to make a query using native query and pagination , in my spring boot aplication. @Query(value = "select * from user pg ", countQuery = "select count(*) from user pg " , nativeQuery = true) Page pesquisar(…
0
votes
1 answer

How to determine the page number of a record using Spring-data-jpa?

I want to return the page number of the page where a certain record is located. I used a conditional query to return all the pagination results, so I couldn’t determine the page where it was based on the recorded id. How can I solve this problem? I…
0
votes
1 answer

How to use Spring Data JPA Pagination with Pageable for changing data?

I am referring the example in this blog - https://www.logicbig.com/tutorials/spring-framework/spring-data/pagination-returning-page.html Pageable pageable = PageRequest.of(0, 500); while (true) { page = repo.findByDept("Sales",…
hemanik
  • 965
  • 3
  • 14
  • 33
0
votes
1 answer

Spring Boot, MongoDB, Pageable, sort by a custom method in the object

Say for example I have the following setup, A model like this: public class Post { @Id private String id; private String post; private List votes = new ArrayList<>(); // Getters & Setters... public double getUpVotes()…
Darragh O'Flaherty
  • 995
  • 3
  • 13
  • 30
0
votes
1 answer

MockHttpServletResponse returning empty body for Pageable endpoint

I have the following test code where I'm testing a Pageable endpoint that list all entries for student. @Autowired private MockMvc mockMvc; @MockBean private StudentRepository studentRepository; private PageableHandlerMethodArgumentResolver…
Marcos
  • 39
  • 10
0
votes
1 answer

How to do searching with parameters using Repository Hibernate and Pageable with Java Spring?

I have just learnt how to do Pageable with Repository Java ( I have a BBDD MySQL) . I basically use DAO with my model (pregunta) and I cast my model to my DTO (preguntaDTO). public Page getAllPreguntasPorPagina(Pageable pageable){ …
DANIEL
  • 13
  • 5
0
votes
1 answer

JPA findAll Pageable Request Total Count Group By Column

I have a code like below: Pageable pageableRequest = PageRequest.of(page, limit, Sort.by(sortBy)); Page userList= null; userList = this.user.findAll(pageableRequest) from here I get all the data and total is shown. However, I want to group…
CloudSeph
  • 863
  • 4
  • 15
  • 36
0
votes
1 answer

Spring Pageable object in get request from React using Axios

I have an endpoint looking like this @GetMapping("/page") Page getEventPage( @PageableDefault(page = 0, size = 20) @SortDefault(sort = "createdDateTime", direction = Sort.Direction.DESC) Pageable pageable) How am I supposed to pass the…
user3344447
  • 15
  • 1
  • 4
0
votes
1 answer

Pageable - sorting by values from several tables

I am writing a native query that collects data from several tables. I also need pageable and sort by alliances. Unfortunately, Sort "sticks" immediately the address of the first table that has no given alliance. Is it possible to dynamically sort…
xampo
  • 369
  • 1
  • 7
  • 22
0
votes
1 answer

Pageable - sorting for constants and variables type

I'm getting a list of objects from the database. I use Pageable for the page, number of elements, etc. Now I need to always have objects of a given type at the beginning of the list (type = "Media") and then other types of objects. And I want to…
xampo
  • 369
  • 1
  • 7
  • 22
0
votes
1 answer

Search by two entities doesn't work with JpaRepository

I'm making an app that holds a UserProfile with Wallet that has many Transactions. Here's the Transaction class: @Entity @Table(name = "transactions") public class Transaction extends BaseEntity { @Column(name = "amount", nullable = false) …
0
votes
0 answers

Spring Pageable null first with SQL Server

In my app I want to add to my pageable object I want to add order null first for selected attribute. I have followed this advice on stack overflow: How to use Pageable as get-query parameter in spring-data-rest? Like this: private Pageable…
Michael
  • 33
  • 5