Generating the otherEntityField From Modelio using jhipster-uml on a one-to-many relationship

394 Views Asked by At

I am trying to generate a Jhipster(2.27.0) application from Modelio(3.4.1) model with JHipster-UML(1.6.0).

On this example I have a one-to-many relationship between 2 entities (assessment and answer). I want to generate the 'otherEntityField' allowing to browse the relation through text and not ID.

The only way I manage to do that was to setup a bidirectional one-to-many relationship like this: Image one-to-many Modelio relationship

And after jhipster-uml generate the code, I have to change the generated entity "Assessment.java". The @OneToMany annotation should use "assessment" mappedBy parameter and not "assessment(entity)".

Before changes:

@OneToMany(mappedBy = "assessment(entity)")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Answer> answers = new HashSet<>();

After changes:

@OneToMany(mappedBy = "assessment")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Answer> answers = new HashSet<>();

After that, it works.

Is this a bug from jhipster-uml or is there a way to generate directly the "otherEntityField" ?

In more concise question : How do you manage a bidirectional one-to-many relationship jhipster-uml generation with "otherEntityField" ?

1

There are 1 best solutions below

0
On

This issue was a bug in jhipster-uml. Issue: https://github.com/jhipster/jhipster-uml/issues/132

Will be corrected in version 1.6.1.