【问题标题】:Spring Roo Generating Unknown Domain ModelSpring Roo 生成未知领域模型
【发布时间】:2018-11-21 14:46:45
【问题描述】:

我刚刚开始使用 Spring Roo,在生成带有实体的简单项目时遇到了问题。我正在关注 DZone 的一篇文章。

DZone How to generate spring boot application

当我按照这些步骤操作时,我会生成一个名为 owner 的域模型,其中包含 2 个字段

  1. 用户名

  2. 电子邮件

当我完成生成项目时,它更正创建了 Owner 模型,但代码中存在对 QOwner 的引用,无法找到它们的类。

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

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

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

【问题讨论】:

    标签: java spring-boot spring-roo


    【解决方案1】:

    记住Q 类是由querydsl-maven-plugin 生成的,因此您必须使用mvn clean compile 编译项目才能使这些类可用。

    之后,如果您使用的是 Eclipse STS 或 IntelliJ,则需要将生成此 Q 类的文件夹 (target/generated-sources/java) 标记为 Source Folder 以允许您的 IDE 检测它们。

    希望对你有帮助,

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-20
      • 1970-01-01
      • 1970-01-01
      • 2018-06-17
      • 1970-01-01
      • 2012-01-12
      相关资源
      最近更新 更多