I upgraded to java 17 and springboot 3.2.0.
Things seem fine but there’s a query whose result set returns null for id of an entity while other fields for same entity are not null. Same query returns a proper response directly in the db (the id
is not null).
I checked out to the branch with the previous versions of java and springboot I used and it worked fine.
In the upgrade, javax is replaced with Jakarta(jakarta.persistence.Id
). However, I noticed that the generated QClasses still have import javax.annotation.processing.Generated;
instead of import jakarta.annotation.Generated;
The generated QClass is also annotated with @Generated("com.querydsl.codegen.DefaultSupertypeSerializer")
instead of @Generated("com.querydsl.apt.JPAAnnotationProcessor")
from what I found out.
I predict this to be the reason why I suddenly have a null
value for the id
. I have a long pom file but I’ll paste the dependencies relevant to what I’m doing for context.
I have spent time on this and tried recommended solutions online without any luck.
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<classifier>jakarta</classifier>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<classifier>jakarta</classifier>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-spatial</artifactId>
<version>${querydsl.version}</version>
</dependency>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<includes>
<include>com.package1.dao.entity</include>
<include>com.package2.dao.entity</include>
<include>com.package3.dao.entity</include>
<include>com.package4.dao.entity</include>
</includes>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
${querydsl.version} is 5.0.0