Query DSL Q type classes not generated

Tags: , , ,

I am trying to use QueryDSL in my eclipse maven project. These are the dependencies.

        <!-- The main class to start by executing java -jar -->




After this I try to write the queries.

public class QueryDSLRepo {

    private EntityManager em;

    public ReportingParamDAO save(final ReportingParamDAO reportingParamDAO) {
        return reportingParamDAO;

    public List<ReportingParamDAO> findreportingParamDAOsByIdQueryDSL(final Integer id) {
        final JPAQuery<ReportingParamDAO> query = new JPAQuery<>(em);
        final QReportingParamDAO reportingParamDAO = QReportingParamDAO.reportingParamDAO;

        return query.from(reportingParamDAO).where(reportingParamDAO.id.eq(id)).fetch();


But I get the error

QReportingParamDAO cannot be resolved to a type

Note: ReportingParamDAO is an entity class.

This means that the Q type class for my DAO is not generated. I am not sure why it wasn’t generated. Do I need to do something else? I came across this post but the user is working on IntelliJ and I can’t seem to make it work in my case. Can someone please help me. Thanks !!


I have tested with your pom.xml. The Q classes were generated for me but I couldn’t access them from my source code. The problem is that the generated-sources is not on classpath by default. Add that on the classpath and you will be able to use them in your source code.

  1. Check the target/generated-sources directory to see if the classes are actually there. (You should be able to find them because I tested with your pom.xml)
  2. If you add target/generated-sources to classpath, you application will work. But I don’t think that is a good idea. Because all the files in the classpath will be indexed by the IDE and your IDE will be slower. All the files in the generated-sources folder need not be indexed. So add target/generated-sources/java to classpath and change your query-dsl plugin to generated Q class to target/generated-sources/java

Source: stackoverflow