如何使 JHipster JDL Import 跳过重新生成现有实体
Posted
技术标签:
【中文标题】如何使 JHipster JDL Import 跳过重新生成现有实体【英文标题】:How to make JHipster JDL Import to skip regenerating existing entities 【发布时间】:2021-07-20 16:13:45 【问题描述】:我有一个由 JHipster 6.7.0 生成的 Monolith 应用程序。我的 JHipster 本地版本是 7.0.1。当我尝试使用 jhipster import-jdl app.jdl 命令导入新实体时,我遇到了与已经可用的实体有关的问题。
ERROR! Error at entity Ticket: relationship name is not synchronized
"relationshipName": "jobs",
"otherEntityName": "ticketJob",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "ticket",
"otherEntity": "[TicketJob Entity]",
"otherEntityField": "id",
"ownerSide": false,
"collection": true,
"otherSideReferenceExists": false,
"otherEntityIsEmbedded": false
with
"relationshipName": "ticket",
"otherEntityName": "ticket",
"relationshipType": "many-to-one",
"otherEntityField": "id",
"otherEntityRelationshipName": "ticketJob",
"otherEntity": "[Ticket Entity]",
"ownerSide": true,
"collection": false,
"otherSideReferenceExists": false,
"otherEntityIsEmbedded": false,
"relatedField":
"fieldName": "id",
"id": true,
"fieldNameHumanized": "ID",
"fieldTranslationKey": "global.field.id",
"autoGenerate": true,
"dynamic": false,
"fieldType": "Long",
"fieldNameCapitalized": "Id",
"fieldNameUnderscored": "id",
"tsType": "number",
"entity": "[Ticket Entity]",
"jpaGeneratedValue": "sequence",
"readonly": true,
"fieldIsEnum": false,
"fieldWithContentType": false,
"fieldNameAsDatabaseColumn": "id",
"columnName": "id",
"fieldInJavaBeanMethod": "Id",
"fieldValidate": false,
"nullable": true,
"unique": false,
"uniqueValue": [],
"path": [
"id"
],
"relationshipsPath": [],
"reference": "[id Reference]",
"relatedByOtherEntity": true
是否可以在导入新版本的新实体时跳过现有实体?还是更容易将现有实体升级到最新版本? (即使我尝试使用 jhipster upgrade 命令升级应用程序,我也会遇到同样的问题
【问题讨论】:
【参考方案1】:问题在于.Jhipster
目录中的 JSON 文件。每当我们升级 JHipster 或导入新实体时,JHipster 都会使用 .JHipster
目录中的 JSON 文件运行整个实体。
我无法获得确切的解决方案,但我确实设法找到了解决方案。我刚刚创建了一个正在创建问题的新实体。我导入了为实体生成新 JSON 文件的实体。我忽略了在导入这个新的 JDL 文件时创建的其他文件。之后,我就可以升级 JHipster 项目了。
【讨论】:
以上是关于如何使 JHipster JDL Import 跳过重新生成现有实体的主要内容,如果未能解决你的问题,请参考以下文章
JHipster 7.1.0:无法使用 jdl-import,在寻找 otherEntity User 时抛出错误
如何为简单的 Region > Country > State > City 下拉菜单设计 Jhipster JDL 关系