如何修改使用 jhipster 生成的现有实体? [英] How to modify existing entity generated with jhipster?

查看:37
本文介绍了如何修改使用 jhipster 生成的现有实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 jhipster 生成器来创建一个项目.我已经按照 jhipster 文档 中提供的信息手动生成了一些实体:

I use jhipster generator to create a projet. I've generated some entity manually following the information provided in jhipster documentation :

如果您更喜欢(或需要)手动进行数据库更新,这里是开发工作流程:修改您的 JPA 实体(添加一个字段、一个关系等)在您的src/main/resources/config/liquibase/changelog 目录.中的文件该目录以其创建日期为前缀(在 yyyyMMddHHmmss格式),然后有一个描述他们做什么的标题.例如,20141006152300_ added_price_to_product.xml 是个好名字.添加这个您的更改日志"文件src/main/resources/config/liquibase/master.xml 文件,所以应用下次运行应用程序时如果您想了解更多信息使用 Liquibase,请访问 http://www.liquibase.org.

这里的文档刚刚提到,如何添加!!!如果我想删除一个字段或实体之间的关系(jpa 实体)怎么办?

Here the documentation just mention, how to add!!! What to do if i want to delete a field or a relation between entities (jpa entity) ?

谢谢

推荐答案

1) 编辑代表实体的 json 文件(添加/删除字段,语法非常简单,如果需要任何更改,请检查文件末尾到诸如fieldsContainOneToMany"之类的一般实体属性...),您将在以下位置找到它:

1) Edit the json file representing your entity (add/remove field, the syntax is pretty easy, check in the end of the file if is required any change to the general entity properties like 'fieldsContainOneToMany'...), you'll find it in:

<jhipster_root_folder>/.jhipster/entityName.json

2) 构建代码.

3) 在项目的根目录中运行以下命令:

3) In the root of your project run the command:

yo jhipster:entity entityName

注意:默认情况下,此命令会覆盖您的所有手动更改.我建议在运行此命令之前在 VCS 存储库上进行提交,以最终恢复任何不需要的更改.

NOTE: this command by default overwrite all your manual changes. I recommend to do a commit on a VCS repository before to run this command to eventually revert any not required change.

4) 运行

mvn liquibase:diff

这篇关于如何修改使用 jhipster 生成的现有实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆