generator-jhipster: "relationship name is not synchronized" is broken

Overview of the issue

There is a check for relationship names, which is incorrect, and prevents perfectly valid JDL setups to be generated And even worse, the error message is very confusing - as very low level - which doesn’t help to solve the issue.

Motivation for or Use Case

I have multiple relations between entities, but I can’t generate the entities with this check in place.

Reproduce the error

JDL:


entity Node {
}

entity OtherEntity {
}
relationship ManyToOne {
     OtherEntity{node} to Node{others}
     Node{mainOther} to OtherEntity
 }

If I add a Node{mainOther} to OtherEntity{reverseMains} - then it will generate the entities, however, that will add a Set<Node> reverseMains to OtherEntity, which I would like to avoid, as doesn’t make too much sense, and could accidentally trigger unwanted db queries, etc

Related issues
Suggest a Fix

I think, this check needs to be removed - or reduce to ‘warning’ level

JHipster Version(s)

Latest main branch

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

What should be the work around for this issue? Is this fixed? I get the same issue even after upgrading the latest version of Jhipster 7.0.1. Issue appears when I try to upgrade the existing application from 6.7.0 to 7.0.1 or when I try to import new entity using import-jdl command. ERROR! Error at entity Ticket: relationship name is not synchronized

same error in 7.8.1 fresh generation

I don’t see why this issue is closed. The problem still remains, jhipster 7.0.0+ does not work with unidirectional while 6.10.5 works perfectly fine. This prevents me from upgrading my jhipster version since I don’t want to add completely unnecessary back-references to my entities.

@ndjordjevic for now you need to add a back name to fix the conflict:

relationship OneToOne {
  Firm{director} to Worker{firmDirector}
}

relationship ManyToOne {
  Worker{firm} to Firm,
}