简体   繁体   English

如何在jhipster jdl中定义与内置用户实体的关系?

[英]How to define a relationship with builtin User entity in jhipster jdl?

The following 下列

>yo jhipster:import-jdl model.jdl

entity Car{
brand String
 }

relationship  ManyToOne{
    Car{owner} to User
}

return parsing error: 返回解析错误:

ERROR! Error while parsing entities from JDL
[object Object]

The same relationship can be built using the command line. 可以使用命令行建立相同的关系。 Is there a way to define this relationship in the JDL ? 有没有一种方法可以在JDL中定义这种关系?

jhipster 3.5.1 jhipster 3.5.1

I've got the same error, and a solution, at lest for my case ;) 我有同样的错误和解决方案,以免我的情况;)

$ yo jhipster:import-jdl ./entities-jdl.jh
The jdl is being parsed.
Error jhipster:import-jdl ./entities-jdl.jh 

ERROR! Error while parsing entities from JDL
[object Object]
  1. Add only few entities or relationships in the file (entities-jdl.jh) 在文件(entities-jdl.jh)中仅添加少量实体或关系
  2. Run again yo jhipster:import-jdl ./entities-jdl.jh 再次运行yo jhipster:import-jdl ./entities-jdl.jh
  3. Repeat until you find the error 重复直到找到错误
  4. Analyse the syntax of the lasts entities or relationship you added 分析添加的最后实体或关系的语法

In my case the JDL error was in this entity: 在我的情况下,JDL错误是在此实体中:

entity Serie {
    tipus TipusSerie required maxlength(20),
    nom String required,
    prefixe String required
}

enum TipusSerie {
    NORMAL, XEC_ESCOLETA
}

TipusSerie is an enum and cannot be validated with maxlength(20), so the correct JDL is: TipusSerie是一个枚举,不能用maxlength(20)进行验证,因此正确的JDL是:

entity Serie {
    tipus TipusSerie required,
    nom String required,
    prefixe String required
}

enum TipusSerie {
    NORMAL, XEC_ESCOLETA
}

I suposse that jhipster hasn't an error messages for that kind of error and shows a generic error message. 我认为jhipster没有针对此类错误的错误消息,而是显示了一般错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM