javajpaspring-dataquerydsljpa-annotations

QueryDSL JPAAnnotation Processor generate QModel for a single class


I have a class that's located in a package. In that package I have several JPAEntities. However all I want for the JPAAnnotationProcessor to do is to generate QModel for a single class. Not for all classes inside that package. Is that possible without moving the class to another package?


Solution

  • You can use @QueryExclude annotation on top of the classes for which you don't want QClass to be generated.

    import com.mysema.query.annotations.QueryExclude
    
    @Entity
    @QueryExclude
    public class MyEntity {}
    

    Unfortunately it is not possible to solve the problem in package level atm. If you mark all package with @QueryExclude and single class with @QueryEntity, still the whole package will be excluded. Therefore you have to mark each class separately.