Git Product home page Git Product logo

Comments (10)

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

Hi,

we had discussed that in Hades already. There's a countQuery attribute at the @Query annotation that allows you to define the query to be used for counting. I don't really want to go down the route of String manipulation for removing parts of the query. So does that workaround do the trick for you?

Cheers,
Ollie

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

Here's the link to the discussion:

http://redmine.synyx.org/issues/361

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Stevo Slavić commented

Yes, that's it, after defining additional countQuery="SELECT count(u) FROM User u" it works. It's not a bug. Couldn't close issue myself. Appologies for making noise

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

No problem, thanks for your feedback ;)

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Piotr Jagielski commented

Using countQuery is a valid workaround but I think it should better be handled by the framework. Having to repeat almost the same query twice is cumbersome, especially when the query is large. It may also result in hard to spot bugs when the main query changes and one forgets to update the count query. The referenced discussion mentions a better solution to remove fetch keywords from the count query.

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Piotr Jagielski commented

On second thought it could probably remove the fetch part altogether instead of just the keyword because fetching shouldn't affect the number of results.

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Manish Shukla commented

I am using Specifications to form Predicates dynamically. Using countQuery is not possible, is there any other workaround to this issue for Specification ?

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

P. J. Reed commented

I just run into this issue; I'm using .findAll on a repository and passing in a Specification, and it's fairly frustrating that I am apparently unable to specify fetches because it breaks the count query

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

Please open a dedicated ticket. This one here is not involving specifications at all

from spring-data-jpa.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

P. J. Reed commented

Done; see DATAJPA-278

from spring-data-jpa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.