Search code examples
javaspring-bootspring-roo

Spring Roo Generating Unknown Domain Model


I have just started to use Spring Roo and I am encountering issues when generating a simple project with an entity. I am following a write up from DZone.

DZone How to generate spring boot application

When I follow the steps I generate a domain model called owner with 2 fields

  1. Username

  2. Email

When I finish generating the project it corrected created the Owner model but there are references to QOwner in the code which are unable to find their class.

@RooJpaRepositoryCustomImpl(repository = OwnerRepositoryCustom.class)
public class OwnerRepositoryImpl extends QueryDslRepositorySupport{

    OwnerRepositoryImpl() {
        super(Owner.class);
    }

    private JPQLQuery getQueryFrom(QOwner qEntity){
        return from(qEntity);
    }
}

OwnerRepositoryImple_Roo_Jpa_Repository_Impl.java


Solution

  • Remember that the Q classes are generated by the querydsl-maven-plugin, so you must compile the project using mvn clean compile to have these classes available.

    After that, if you are using Eclipse STS or IntelliJ, you need to mark the folder where this Q classes are generated (target/generated-sources/java) as Source Folder to allow your IDE to detect them.

    Hope it helps,