I have an @Entity class that I use querydsl code generation on.

Problem: my entity has a parent entity which contains some @Transient fields. And those are not skipped during generation.

package com.domain.myentity

@Entity
public class MyEntity extends AuditingEntity {

}


package com.auditing

@MappedSuperclass
public class AuditingEntity {
    @Transient
    private transient Object obj;
}

package-info.java:

@QueryEntities(value = MyEntity.class)
package com.domain.myentity

import com.querydsl.core.annotations.QueryEntities;
import com.domain.myentity.MyEntity;

Question: how can I tell querydsl to ignore any @Transient fields automatically? Currently the root cause is probably that the AuditingEntity is in a different folder than the domain entity, and therefore not listed in the package-info.java of querydsl. But how could I solve it without having to move the auditing entity?

Generated during:

<plugin>
    <groupId>com.mysema.maven</groupId>
    <artifactId>apt-maven-plugin</artifactId>
    <version>${apt-maven-plugin.version}</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>process</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
                <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>${querydsl.version}</version>
        </dependency>
    </dependencies>
</plugin>

1 Answers

0
Erçin Akçay On

Could you try transient declaration as transient String obj; instead of

@Transient
private Object obj;