javahibernatequerydsl

Cannot import import com.querydsl.jpa.impl.JPAQuery;


I am trying to use QueryDSL. I followed Querydsl Reference Guide but can't use JPAQuery anyway. I tried import it with import com.querydsl.jpa.impl.JPAQuery; but it didn't work.

Here is what i added in pom.xml

        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
            <classifier>jakarta</classifier>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>5.0.0</version>
            <classifier>jakarta</classifier>
        </dependency>
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I guess that there is no com.querydsl.jpa in my External Libraries. How do i get it?


Solution

  • I did everything right with adding dependencies in pom.xml, but Intellij as smart IDE saw a vulnerability in querydsl dependencies. And I just clicked to ignore that vulnerability to remove enormous dependency highlighting. That is problem:)

    It was ignored and not downloaded to External Libraries. Btw I needed the querydsl-jpa dependency to be downloaded in External Libraries to properly import com.querydsl.jpa.impl.JPAQuery

    I just deleted those dependencies, refreshed pom.xml, and added it again without ignoring them.

    There is image of this thing: image with vulnerable dependency in Intellij