Some online examples for Mysema Querydsl usage rely on the JPAQuery#list()
method, e.g. this stackoverflow answer containing a GROUP BY / COUNT aggregate example. It is also referred to throughout the official documentation.
However, I do just not see this method on the JPAQuery
class. It doesn't show up in the IDE's autocomplete, and it's not present in the JAR file downloaded by Maven.
I have added these dependencies to my Maven project:
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>4.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>4.0.4</version>
</dependency>
Why is the JPAQuery#list()
method not present?
The method JPAQuery.list
was removed when Querydsl upgraded from the 3.x to the 4.x line. Since you are using version 4.0.4, this method is no longer available.
As I understand from reading the release notes, version 4 introduces a lot of major changes in the code base that breaks older code. You have two options:
list
methodfetch
method instead. Take a look at this GitHub issue for the list of changes.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With