通过jhipster给实体添加字段

Add fields to entity by means of jhipster

我在 jhipster 的帮助下创建了实体并手动修改了实体。 随着时间的推移,我需要添加更多字段。 我 运行 jhipster entity Download 并按照说明一步步进行。此后生成器说出冲突并提供完全替换许多文件:

 conflict .jhipster/Download.json
? Overwrite .jhipster/Download.json? show the differences between the old and the new

所以应该是? 然后我不明白什么代码包含下一个注释行:

@CreatedBy
@ManyToOne
@JsonIgnoreProperties("downloads")
private User user;

// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public UUID getId() {
    return id;
}

要在 JHipster 实体中添加字段,唯一可行的方法是重新生成该实体并覆盖现有文件。

添加的 needle 当前未被 JHipster 使用(我在代码中找不到对它的引用)并且存在只是因为它是用户在此问题中请求的 https://github.com/jhipster/generator-jhipster/issues/6246.