首页 > 解决方案 > 通过 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;
}

标签: javajhipster

解决方案


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

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


推荐阅读