I make use of an @Entity class from a commons library:
@Entity
public class Person {
@Id
private long id;
private String firstname;
@NotNull
private String lastname;
}
In my impl application, I want to generated a QPerson querydsl entity. But how? Because I have no control over the commons library, I cannot simply add the @QueryEntity annotation for the querydsl processor.
I found a solution. Yet I don't know if that's the correct way, so would be still happy for your comments.
Create a package-info somewhere in the implementation project as follows:
@QueryEntities(value = {Person.class})
package my.impl.project
What is strange: now all of the entity classes from the commons project get generated. Therefore I restricted the path in maven:
<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>
<options>
<querydsl.includedPackages>org.common.domain.person</querydsl.includedPackages>
</options>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
</dependencies>
</plugin>
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