Skip to content

Update documentation to use jakarta.persistence.* for Querydsl setup #1121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weaselmetal opened this issue Feb 11, 2025 · 3 comments
Closed
Assignees
Labels
type: documentation A documentation task
Milestone

Comments

@weaselmetal
Copy link

Hi,

I tried to follow these instructions https://docs.spring.io/spring-graphql/reference/data.html#data.querydsl.build but even with querydsl 5.1.0 I had no success. I think I would have to go back to javax.persistence.Entity (and other javax stuff) but that feels wrong with Spring Boot 3.4.0.

With

mvn clean compile -X -Dprocessor=com.querydsl.apt.jpa.JPAAnnotationProcessor

and

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.13.0</version>
	<configuration>
		<source>21</source>
		<target>21</target>
		<annotationProcessorPaths>
			<path>
				<groupId>com.querydsl</groupId>
				<artifactId>querydsl-apt</artifactId>
				<version>5.1.0</version>
			</path>
		</annotationProcessorPaths>
		<generatedSourcesDirectory>${project.build.directory}/generated-sources/annotations
		</generatedSourcesDirectory>
		<compilerArgs>
			<arg>-proc:only</arg>
		</compilerArgs>
	</configuration>
</plugin>

I'm warned that

[WARNING] Annotation processing without compilation requested but no processors were found.

Ultimately, no Q... classes are generated. Let me know if I'm doing something wrong, but the Spring Boot version 3.4 with its graphql-starter doesn't work with repository that extends QuerydslPredicateExecutor.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 11, 2025
@mp911de
Copy link
Member

mp911de commented Feb 12, 2025

Make sure to use the jakarta classifier for all Querydsl artifacts, including the annotation processor querydsl-apt. Querydsl provides artifacts with the jakarta classifier for transition from javax to jakarta.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Feb 12, 2025
@mp911de mp911de self-assigned this Feb 12, 2025
@mp911de mp911de added type: documentation A documentation task and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Feb 12, 2025
@rstoyanchev rstoyanchev added this to the 1.3.4 milestone Feb 12, 2025
@weaselmetal
Copy link
Author

Thanks for the response @mp911de! Since I wasn't willing to accept my failure, I spent some time on research, which led me to this article https://www.patrick-gotthard.de/querydsl-mit-spring-boot-3-nutzen/ (in the end).
Ultimately I created this little project: https://github.com/weaselmetal/qdsltest
So yes, once you know how (I did not know about the jakarta classifier) it is possible to use QueryDSL in Spring Boot 3.x.

Perhaps the Spring page I referenced in my OP should be updated, but you labelled this issue accordingly already. Thanks again Mark!

@mp911de mp911de changed the title QueryDSL setup requires javax annotations, jakarta.persistence.* don't work Update documentation to use jakarta.persistence.* for Querydsl setup Feb 13, 2025
@mp911de
Copy link
Member

mp911de commented Feb 13, 2025

The issue comes from us using javax annotations in Spring GraphQL 1.0.x and not updating the docs with the migration to Jakarta Annotations/Spring Boot 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

4 participants