Problem when using Sort.by #3721
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
this is my whole code
https://github.com/oungsi2000/jump-to-springboot
When I use JpaRepository with Sort.by and Pageable, I got some mismatch with this.
com.ll.jumptospringboot.domain.Answer.AnswerService.getList
com.ll.jumptospringboot.domain.Answer.Answer
when using 'sorts.add(Sort.Order.desc("voter"));', If there are two or more voters, this.a
nswerRepository.findAllByQuestion(question, pageable); -> this doesn't get all Answers, instead gets pagination - 1 Answers
this is the result when the code above 'if (Objects.equals(sortBy, "mostVoted"))~~' executed
asdfad
this is the result when the code above 'else~~' executed
스크린샷 2024-12-18 오후 8 39 05
both counts should be same because the count means "All Answers" and it gets from same DB, same Hibernate query.
the difference between those is only 'sorts.add(Sort.Order.desc("voter"));' and attribute voter is @manytomany.
It is more strange that when the Entity Answer gets only one voter attribute, it works perfectly(both count is same) but when it gets two or more voter attribute, it just returns 9, not all of All Answers.
Please Help
If my English is Bad, I'm sorry. If you need extra explanation, Please notify me.
The text was updated successfully, but these errors were encountered: