为什么 jhipster:import-jdl 给我一个 IllegalAssociationException?
Why jhipster:import-jdl is giving me an IllegalAssociationException?
我有这个 UML:
entity Profile {
creationDate Instant required
bio String maxlength(7500)
}
entity Grupo {
creationDate Instant required
groupname String minlength(2) maxlength(100) required
image ImageBlob
isActive Boolean
}
// RELATIONSHIPS:
relationship OneToOne {
Profile{grupo} to Grupo{profile}
}
relationship OneToMany {
User{grupo} to Grupo{user(id) required}
}
// DTO for all
dto * with mapstruct
// Set pagination options
paginate all with pagination
// Set service options to all except few
service all with serviceImpl
当我 运行 它与 yo jhipster:import-jdl 时,它给出了以下错误:
IllegalAssociationException: Relationships from User entity is not supported in the declaration between User and Grupo.
Error jhipster:import-jdl ./src/main/scripts/raro.jh
是否不允许与用户实体建立一对多关系?问题是 OneToOne 关系工作正常。
因为当我将关系更改为 ManyToOne 时,它起作用了
entity Profile {
creationDate Instant required
bio String maxlength(7500)
}
entity Groups {
creationDate Instant required
groupname String minlength(2) maxlength(100) required
image ImageBlob
isActive Boolean
}
// RELATIONSHIPS:
relationship OneToOne {
Profile{groups(groupname)} to Groups{profile}
}
// relationship OneToMany {
// User{groups} to Groups{user(id) required}
// }
relationship ManyToOne {
Groups{user(id) required} to User{groups}
}
// DTO for all
dto * with mapstruct
// Set pagination options
paginate all with pagination
// Set service options to all except few
service all with serviceImpl
为什么?我在第一个例子中做了什么吗?
谢谢
默认情况下,JHipster 不允许与用户建立 OneToMany
关系。如果你需要这个,你将不得不手动更改代码。
Please note that the User entity, which is handled by JHipster, is specific. You can do:
- many-to-one relationships to this entity (a Car can have a many-to-one relationship to a User)
- many-to-many and one-to-one relationships to the User entity, but the other entity must be the owner of the relationship (a Team can have a many-to-many relationship to User, but only the team can add/remove users, and a user cannot add/remove a team)
我有这个 UML:
entity Profile {
creationDate Instant required
bio String maxlength(7500)
}
entity Grupo {
creationDate Instant required
groupname String minlength(2) maxlength(100) required
image ImageBlob
isActive Boolean
}
// RELATIONSHIPS:
relationship OneToOne {
Profile{grupo} to Grupo{profile}
}
relationship OneToMany {
User{grupo} to Grupo{user(id) required}
}
// DTO for all
dto * with mapstruct
// Set pagination options
paginate all with pagination
// Set service options to all except few
service all with serviceImpl
当我 运行 它与 yo jhipster:import-jdl 时,它给出了以下错误:
IllegalAssociationException: Relationships from User entity is not supported in the declaration between User and Grupo.
Error jhipster:import-jdl ./src/main/scripts/raro.jh
是否不允许与用户实体建立一对多关系?问题是 OneToOne 关系工作正常。
因为当我将关系更改为 ManyToOne 时,它起作用了
entity Profile {
creationDate Instant required
bio String maxlength(7500)
}
entity Groups {
creationDate Instant required
groupname String minlength(2) maxlength(100) required
image ImageBlob
isActive Boolean
}
// RELATIONSHIPS:
relationship OneToOne {
Profile{groups(groupname)} to Groups{profile}
}
// relationship OneToMany {
// User{groups} to Groups{user(id) required}
// }
relationship ManyToOne {
Groups{user(id) required} to User{groups}
}
// DTO for all
dto * with mapstruct
// Set pagination options
paginate all with pagination
// Set service options to all except few
service all with serviceImpl
为什么?我在第一个例子中做了什么吗? 谢谢
默认情况下,JHipster 不允许与用户建立 OneToMany
关系。如果你需要这个,你将不得不手动更改代码。
Please note that the User entity, which is handled by JHipster, is specific. You can do:
- many-to-one relationships to this entity (a Car can have a many-to-one relationship to a User)
- many-to-many and one-to-one relationships to the User entity, but the other entity must be the owner of the relationship (a Team can have a many-to-many relationship to User, but only the team can add/remove users, and a user cannot add/remove a team)