首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jhipster导入- jdl不从jdl文件生成实体

jhipster导入- jdl不从jdl文件生成实体
EN

Stack Overflow用户
提问于 2016-06-28 11:40:28
回答 1查看 2.1K关注 0票数 1

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

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

代码语言:javascript
复制
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文件内容:

代码语言:javascript
复制
{
  "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文件内容:

代码语言:javascript
复制
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文件中的条目序列(首先是所有实体,然后是关系) ->不能工作
EN

回答 1

Stack Overflow用户

发布于 2016-09-01 08:10:05

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

代码语言:javascript
复制
$ 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...

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

代码语言:javascript
复制
entity InsuranceProvider {  
    name String required,  
    isActive Boolean,  
    createdDate ZonedDateTime,  
    modifiedDate ZonedDateTime  
}

而不是:

代码语言:javascript
复制
entity InsuranceProvider {  
    name String required,  
    isActive Boolean,  
    createdDate ZonedDateTime,  
    modifiedDate ZonedDateTime ,
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38075234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档