簡體   English   中英

從JDL文件jhipster解析實體時出錯

[英]Error while parsing entities from JDL file jhipster

我使用JDL Studio創建文件沒有錯誤,但是使用jhipster cli導入文件時出現以下錯誤:

Using JHipster version installed locally in current project's node_modules Executing jhipster:import-jdl ./thearthacker-jdl.jh
Options:
The jdl is being parsed.
events.js:182
      throw er; // Unhandled 'error' event
      ^
Error: ERROR!
Error while parsing entities from JDL
    at Environment.error (E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-environment\lib\environment.js:140:40)
    at constructor.error (E:\web_project\_PROJECT\thearthackers\node_modules\generator-jhipster\generators\generator-base.js:1686:18)
    at constructor.parseJDL (E:\web_project\_PROJECT\thearthackers\node_modules\generator-jhipster\generators\import-jdl\index.js:108:22)
    at Object. (E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-generator\lib\index.js:417:23)
    at E:\web_project\_PROJECT\thearthackers\node_modules\run-async\index.js:25:25
    at Promise ()
    at E:\web_project\_PROJECT\thearthackers\node_modules\run-async\index.js:24:19
    at E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-generator\lib\index.js:418:9
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)

這是我的JDL文件:

entity Video {
    name String required,
    type String required,
    url String required,
    quality String,
   description String required,
    submissionDate ZonedDateTime required
}
entity Picture {
    name String required minlength(3),
    type String required,
    url String required,
    size String,
    description String,
    submissionDate ZonedDateTime required
}

entity Blog {
    name String required minlength(3),
}

entity Entry {
    title String required,
    content String required,
    date ZonedDateTime required
}

entity Tag {
    name String required minlength(2)
}


relationship ManyToMany {
    Entry{tag(name)} to Tag{entry}
}

relationship ManyToMany {
    Picture{tag(name)} to Tag{Picture}
}

relationship ManyToMany {
    Video{tag(name)} to Tag{Video}
}

relationship ManyToMany {
    Blog{tag(name)} to Tag{Blog}
}

relationship ManyToMany {
    User{tag(name)} to Tag{User}
}

relationship ManyToOne {
    Video{video} to User
}

relationship ManyToOne {
    Picture{video} to User
}

relationship ManyToOne {
    Blog{video} to User
}

relationship ManyToOne {
    Entry{video} to Blog
}

paginate Entry, Tag with infinite-scroll

dto * with mapstruct

任何想法 ?

感謝幫助。

我剛剛嘗試了您的JDL並收到以下錯誤消息:

IllegalAssociationException: Relationships from User entity is not supported in the declaration between User and Tag.

請注意,我正在使用當前的開發分支,因此我收到一條您可能沒有的錯誤消息(您沒有提供您的版本號,但是最近進行了改進)。

這意味着您無法與User實體建立關系,因為它無法被JDL修改-這是特定於User實體的。 您可以在關系文檔中找到更多信息。

有幾種解決方案:您可以與用戶建立一對一關系,並擁有另一個通過JDL管理的實體。 或者,您可以手動修改User實體(有些人將其子類化,然后使用該子類,以便不更改User)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM