我使用 jhipster 生成器来创建一个项目。我根据 jhipster documentation 中提供的信息手动生成了一些实体。 :
If you prefer (or need) to do a database update manually, here is the development workflow: Modify your JPA entity (add a field, a relationship, etc.) Create a new "change log" in your src/main/resources/config/liquibase/changelog directory. The files in that directory are prefixed by their creation date (in yyyyMMddHHmmss format), and then have a title describing what they do. For example, 20141006152300_added_price_to_product.xml is a good name. Add this "change log" file in your src/main/resources/config/liquibase/master.xml file, so it is applied the next time you run your application If you want more information on using Liquibase, please go to http://www.liquibase.org.
这里的文档刚刚提到,如何添加!!! 如果我想删除一个字段或实体之间的关系(jpa 实体)怎么办?
谢谢
最佳答案
1) 编辑代表您的实体的 json 文件(添加/删除字段,语法非常简单,如果需要对“fieldsContainOneToMany”等一般实体属性进行任何更改,请检查文件末尾...),您可以在以下位置找到它:
<jhipster_root_folder>/.jhipster/entityName.json
2) 构建代码。
3) 在项目的根目录中运行命令:
yo jhipster:entity entityName
注意:默认情况下,此命令会覆盖您的所有手动更改。我建议在运行此命令之前在 VCS 存储库上进行提交,以最终恢复任何不需要的更改。
4) 运行
mvn liquibase:diff
关于java - 如何修改使用 jhipster 生成的现有实体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28216307/