如何编辑 Jhipster Spring 数据库

How to edit Jhipster Spring database

我目前在 Jhipster 生成的 Spring 项目中工作。有时我必须更改我的实体(域),所以每次我都必须更改 liquibase 更改日志文件并删除数据库。所以无论如何我只需要更改我的域文件和 liquibase 自动为我重新生成的更改日志。

例如:这是 My project structure

每次我想更改我的实体时,我都必须更改我的域文件,我也必须更改我的 liquibase 变更日志文件,

只需运行 jhipster entity YourEntity,它就会为您进行更改。如果您已经通过导入JDL文件创建应用程序,您可以再次导入它以更新生成的源代码。

Updating an existing entity

The entity configuration is saved in a specific .json file, in the .jhipster directory. So if you run the sub-generator again, using an existing entity name, you can update or regenerate the entity.

When you run the entity sub-generator for an existing entity, you will be asked a question ‘Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be overwritten’ with following options:

  • Yes, re generate the entity - This will just regenerate your entity. Tip: This can be forced by passing a --regenerate flag when running the sub-generator
  • Yes, add more fields and relationships - This will give you questions to add more fields and relationships
  • Yes, remove fields and relationships - This will give you questions to remove existing fields and relationships from the entity
  • No, exit - This will exist the sub-generator without changing anything

参见: