jhipster import-jdl不从jdl文件生成实体

时间:2016-06-28 11:40:28

标签: jhipster

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

以下是我的cmd终端的片段:

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文件中的条目序列(首先是所有实体,然后是关系) - >不工作

1 个答案:

答案 0 :(得分:0)

我尝试使用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 ,
}
相关问题