静态元模型类未生成 [英] Static metamodel class is not generated

查看:75
本文介绍了静态元模型类未生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习和使用Jhipster.我对JPA静态元模型生成有疑问.以下是我根据Jhipster网站所做的操作,但未生成静态matemodel类(X_类):

I just started learning and using Jhipster. I have a question about JPA Static metamodel generation. The following is what I have done according to the Jhipster website but the static matemodel class(Class X_) is not generated:

我创建了一个实体:SalesByDepartment.生成此实体之后,我通过将service设置为从no到serviceImpl并将jpaMetamodelFiltering设置为true,将其项目文件夹下的JOSN文件从项目文件夹下的.jhipster更改了.我的理解是,在对该实体的JSON文件进行此更改之后,我需要重新运行实体子生成器以重新生成同一实体,以启用过滤功能.但是,我只能找到"SalesByDepartmentCriteria"和"SalesByDepartmentQueryService".域包下没有类"SalesByDepartment_".我还检查了pom.xml并找到了插件:

I created an entity called: SalesByDepartment. After this entity generated, I changed its JOSN file from folder:.jhipster under my project folder by setting service to serviceImpl from no, and jpaMetamodelFiltering to true. My understanding is that I need to re-run entity sub-generator to regenerate the same entity to enable Filtering feature after I've done this change to this entity's JSON file. However, I only can find 'SalesByDepartmentCriteria' and 'SalesByDepartmentQueryService'. There is no class 'SalesByDepartment_' under the domain package. I also checked pom.xml and I can find the plugin:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${mapstruct.version}</version>
                    </path>
                    <!-- For JPA static metamodel generation -->
                    <path>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-jpamodelgen</artifactId>
                        <version>${hibernate.version}</version>
                    </path>

                </annotationProcessorPaths>
            </configuration>
        </plugin>

我可以知道在域包下生成"SalesByDepartment_"时是否还有其他遗漏吗?

May I know if anything else I have missed to generate 'SalesByDepartment_' under domain package?

谢谢您的帮助.

顺便说一句,当我生成第一个项目时,它运行良好.我以相同的方式进行操作,并在项目文件夹"com.xxx.domain"下自动创建了静态元模型类.在使用Maven构建过程之后,我也可以在目标文件夹下找到它们.我想这是有问题的,但仍然不知道为什么会这样.以下是我使用"jhipster"创建的两个项目的屏幕截图. A是我可以生成静态元模型的先前项目,但是B不起作用: 在此处输入图片描述

By the way, it worked fine when I generated the first project. I did the same way and static metamodel classes were created automatically under project folder: 'com.xxx.domain'. I also can find them under target folder after build process with Maven. I guess there are something wrong but still have no idea why is that. Below is the screen shot for two projects that I have created using 'jhipster'. A is the previous project which I could generate static metamodel, but B doesn't work: enter image description here

推荐答案

JPA静态元模型由构建过程(Maven或Gradle)生成,如

JPA Static metamodel is generated by build process (maven or gradle) as explained in JHipster doc so you just have to build your app and you'll find SalesByDepartment_.java under target for maven and under build for gradle.

这篇关于静态元模型类未生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆