问题描述
我需要使用命令"yo jhipster:entity myEntity"使用JHipster创建自己的实体,该命令与JHipster中默认提供的User实体具有多对一的关系.
I need to create my own entities using the JHipster using the command "yo jhipster:entity myEntity" that have many-to-one relationship with the User entity that comes by default in JHipster.
我尝试在向导中创建与实体用户"和字段登录"的关系但未成功.
I have tried unsuccessfully to create in the wizard a relationship with the entity "user" and the field "login" but it is not working.
用JHipster做到这一点的好方法是什么?还是我必须在没有JHipster工具的情况下创建实体(但是我需要CRUD!).
What is the good way to do this with JHipster? Or do I have to create the entity without JHipster tool (but I need the CRUD!).
谢谢
Yann
推荐答案
只是更新-前几天发布了jhipster 2.5.0,添加了对此的支持.创建此答案是因为注释中的格式使我很难阅读.
Just an update - jhipster 2.5.0 was released a few days ago adding support for this. Created this answer since the formatting in comments make i pretty hard to read.
为您的实体创建关系时,只需回答以下问题
When creating a relation for your entity simply answer the questions like this
? Do you want to add a relationship to another entity? Yes
? What is the name of the other entity? user
? What is the name of the relationship? owner
? What is the type of the relationship? many-to-one
? When you display this relationship with AngularJS, which field from 'user' do you want to use? login
关于如何显示关系的可能值可能是:ID,登录名,名字,姓氏,电子邮件
Possible values on how to display the relation could be: id, login, first_name, last_name, email
请参见 https://jhipster.github.io/2015/03/01/jhipster-release-2.5.0.html 了解更多信息
这篇关于在JHipster中如何创建与用户有关系的实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!