Hett
Hett

Reputation: 3813

Add fields to entity by means of jhipster

I created entity with help jhipster and modify entity manually. Over time I need to add more field. I run jhipster entity Download and follow instructions step-by-step. Thereafter generator say about conflicts and offers to completely replace many files:

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

So it should be? Then I do not understand for what code contains next comment lines:

@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;
}

Upvotes: 2

Views: 3289

Answers (1)

Pierre Besson
Pierre Besson

Reputation: 740

To add fields in JHipster entities, the only practical way is to regenerate that entity and overwrite the existing files.

The needle that is added is currently unused by JHipster (I could find no reference to it in the code) and exists only because it was requested by a user in this issue https://github.com/jhipster/generator-jhipster/issues/6246.

Upvotes: 1

Related Questions