简体   繁体   English

在Jhipster中与用户(jhiUser)创建实体关系

[英]creating a entity relationship with user (jhiUser) in Jhipster

I have two entities "user" which is already created by jhipster and "car" the car have Many-to-one(bidirectional) relation with user 我有两个已由jhipster创建的实体“用户”和“汽车”,汽车与用户具有多对一(双向)关系

my queries are : 我的查询是:

1> when I type yo jhipster:entity user it is creating new user entity rather then updating existing one I have also tried yo jhipster:entity jhiUser 1>当我键入yo jhipster:entity user它是在创建新的用户实体,而不是更新现有的用户实体,我也尝试过yo jhipster:entity jhiUser

2> Where to use what ? 2>在哪里使用什么? either to use "user" or "jhiUser" and where? 要么使用“用户”或“ jhiUser”,在哪里?

This is normal you cannot create an entity which already exists especially User which is used for access control and basically this is what you tried by running yo jhipster:entity user . 这是正常的,您不能创建一个已经存在的实体,尤其是用于访问控制的User,基本上这是您通过运行yo jhipster:entity user尝试过的。

You can't do bi-directional relations with user using entity sub generator, you could create many-to-one relation from car to user and then modify User manually. 您不能使用实体子生成器与用户建立双向关系,而是可以创建从汽车到用户的多对一关系,然后手动修改用户。

Alternatively you could create a one-to-one relation between User and another entity CarOwner which would have a bi-directional one-to-many relationship with Car. 或者,您可以在用户和另一个实体CarOwner之间创建一对一关系,该实体与Car具有双向的一对多关系。

There are many questions about relations with User that you could search in stackoverflow. 您可以在stackoverflow中搜索有关与用户的关系的许多问题。

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

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