Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jhipster用户-朋友-自我关系_Jhipster - Fatal编程技术网

Jhipster用户-朋友-自我关系

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中创建与用户实

我想在使用实体“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
}

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中我们不能直接和用户建立关系。