gpt4 book ai didi

java - 从 JDL 文件 jhipster 解析实体时出错

转载 作者:行者123 更新时间:2023-12-03 02:31:53 25 4
gpt4 key购买 nike

我使用 JDL studio 创建文件没有错误,但是当我使用 jhipster cli 导入文件时出现以下错误:

Using JHipster version installed locally in current project's node_modules Executing jhipster:import-jdl ./thearthacker-jdl.jhOptions: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)

and this is my JDL file:

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.

请注意,我正在使用当前的开发分支,因此我收到了一条您可能没有的错误消息(您没有提供版本号,但最近已得到改进)。

这意味着您无法从用户实体建立关系,因为 JDL 无法修改它 - 这是特定于用户实体的。您可以找到更多信息on the relationships documentation .

对此有多种解决方案:您可以与用户建立一对一的关系,并通过 JDL 管理另一个实体。或者您可以手动修改 User 实体(有些人将其子类化并在子类上工作,以免更改 User)。

关于java - 从 JDL 文件 jhipster 解析实体时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46745832/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com