【问题标题】:jhipster import-jdl not generating entities from jdl filejhipster import-jdl 不从 jdl 文件生成实体
【发布时间】:2016-10-30 17:21:41
【问题描述】:

我使用 jdl-studio 创建了一个 jdl 文件。 我绑定使用 jdl-import 从 jdl 文件创建实体。

下面是我的cmd终端的sn-p:

D:\spring-boot\examples\espressob>yo jhipster:import-jdl ./jhipster-jdl.jh
The jdl is being imported.
D:\spring-boot\examples\espressob>

问题

它只是打印 jdl 文件正在被导入,就是这样。 我检查了它是否为 jdl 文件中的实体生成代码,不幸的是它没有。


环境详情

.yo-rc.json 文件内容:

{
  "generator-jhipster": {
    "jhipsterVersion": "3.4.2",
    "baseName": "espressob",
    "packageName": "com.iwantunlimited.espressob",
    "packageFolder": "com/iwantunlimited/espressob",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "hazelcast",
    "clusteredHttpSession": "hazelcast",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": "elasticsearch",
    "buildTool": "maven",
    "enableSocialSignIn": true,
    "jwtSecretKey": "790501d7e04040394e33964a4ee715408ec0408f",
    "useSass": true,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "cucumber",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "fr",
      "hi"
    ]
  }
}

jhipster-jdl.jh文件内容:

entity InsuranceCategory {
    name String required,
    description String,
    isActive Boolean,
    createdDate ZonedDateTime,
    modifiedDate ZonedDateTime,
}
relationship ManyToOne {
    InsuranceCategory{createdBy} to User
}
relationship ManyToOne {
    InsuranceCategory{modifiedBy} to User
}

entity InsuranceProvider {
    name String required,
    isActive Boolean,
    createdDate ZonedDateTime,
    modifiedDate ZonedDateTime,
}
relationship ManyToOne {
    InsuranceProvider{createdBy} to User
}
relationship ManyToOne {
    InsuranceProvider{modifiedBy} to User
}
relationship ManyToMany {
    InsuranceCategory{provider} to InsuranceProvider{category}
}

entity Policy {
    name String required,
    isActive Boolean,
    createdDate ZonedDateTime,
    modifiedDate ZonedDateTime,
}
relationship ManyToOne {
    Policy{createdBy} to User
}
relationship ManyToOne {
    Policy{modifiedBy} to User
}

relationship OneToMany {
    InsuranceCategory{policy} to Policy
}

relationship OneToMany {
    InsuranceProvider{policy} to Policy
}

dto all with mapstruct

试过了:

  1. 删除与用户实体的关系 -> 不起作用

  2. 重新排列 jdl 文件中的条目序列(首先是所有实体,然后是关系)-> 不起作用

【问题讨论】:

  • 您是否尝试过导入 (jhipster import-jdl jhipster-jdl.jh) 从文件 (jhipster-jdl.jh) 所在的同一子目录调用它? (不带 ./)

标签: jhipster


【解决方案1】:

我尝试使用 jhipster 3.6.1 版本的 jdl 文件,它适用于以下警告:

$ yo jhipster:import-jdl ./jhipster-jdl.jh  
The jdl is being parsed.  
**Warning:  An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.**  
Writing entity JSON files.  
Generating entities...

还建议删除实体定义中最后一个字段末尾的逗号:

entity InsuranceProvider {  
    name String required,  
    isActive Boolean,  
    createdDate ZonedDateTime,  
    modifiedDate ZonedDateTime  
}

代替:

entity InsuranceProvider {  
    name String required,  
    isActive Boolean,  
    createdDate ZonedDateTime,  
    modifiedDate ZonedDateTime ,
}

【讨论】:

    猜你喜欢
    • 2016-10-06
    • 2018-10-04
    • 2017-10-21
    • 1970-01-01
    • 2021-01-14
    • 2021-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多