Jhipster用户-朋友-自我关系
我想在使用实体“friend”的用户之间创建一个“friend”关系。 我试过这个,但不管用Jhipster用户-朋友-自我关系,jhipster,Jhipster,我想在使用实体“friend”的用户之间创建一个“friend”关系。 我试过这个,但不管用 entity Friend { status Boolean, modified LocalDate, created LocalDate } relationship ManyToMany { Friend{user(login)} to User, User to Friend{user(login)} } 我怎么能做到 谢谢您无法在JDL中创建与用户实
entity Friend {
status Boolean,
modified LocalDate,
created LocalDate
}
relationship ManyToMany {
Friend{user(login)} to User,
User to Friend{user(login)}
}
我怎么能做到
谢谢您无法在JDL中创建与
用户
实体的关系
解决方法是创建另一个实体并使用一对一的关系,如下所示
entity Friend {
status Boolean,
modified LocalDate,
created LocalDate
}
entity UserExtended {
...
}
relationship OneToOne {
UserExtended to User
}
relationship ManyToMany {
Friend{userExtended(login)} to UserExtended,
UserExtended to Friend{userExtended(login)}
}
您可能需要考虑在生成的代码中直接与<代码>用户< /代码>建立关系。 您不能在JDL中创建与
用户实体的关系
解决方法是创建另一个实体并使用一对一的关系,如下所示
entity Friend {
status Boolean,
modified LocalDate,
created LocalDate
}
entity UserExtended {
...
}
relationship OneToOne {
UserExtended to User
}
relationship ManyToMany {
Friend{userExtended(login)} to UserExtended,
UserExtended to Friend{userExtended(login)}
}
您可能需要考虑在生成的代码中直接与<代码>用户< /代码>建立关系。 找到了它:
entity UserExtra {
.....
}
entity Friend{
status Boolean,
modified LocalDate,
created LocalDate
}
relationship OneToOne {
UserExtended{user(login)} to User
}
relationship OneToMany {
UserExtended{friends} to Friend{user}
}
relationship ManyToOne {
UserExtended{friend} to UserExtended{users}
}
找到它:
entity UserExtra {
.....
}
entity Friend{
status Boolean,
modified LocalDate,
created LocalDate
}
relationship OneToOne {
UserExtended{user(login)} to User
}
relationship OneToMany {
UserExtended{friends} to Friend{user}
}
relationship ManyToOne {
UserExtended{friend} to UserExtended{users}
}
好的,在JDL中我们不能直接和用户建立关系。好的,在JDL中我们不能直接和用户建立关系。