generator-jhipster: JPA Derived Identifier combined with mapstruct generates code that doesn't compile
Overview of the issue
Combination of dto with mapstruct and use of jpaDerivedIdentifier doesn’t work.
Motivation for or Use Case
Generated code should compile
Reproduce the error
Use the following JDL:
application {
config {
baseName mapsIdBugWithDTO
applicationType microservice
databaseType sql
prodDatabaseType postgresql
}
entities *
}
entity A
entity B
relationship OneToOne {
A to B with jpaDerivedIdentifier
}
dto * with mapstruct
<del>Because of #10739, once the application and entities have been generated with jhipster import-jdl, you have to manually fix .jhipster/A.json and .jhipster/A.json and regenerate both entities with jhipster entity A --regenerate --force and jhipster entity A --regenerate --force</del>
Then you have multiple compilation errors:
[ERROR] src/main/java/com/mycompany/myapp/web/rest/AResource.java:[55,32] cannot find symbol
symbol: method getBId()
location: variable aDTO of type com.mycompany.myapp.service.dto.ADTO
[ERROR] src/main/java/com/mycompany/myapp/service/AService.java:[49,24] cannot find symbol symbol: method getBId()
location: variable aDTO of type com.mycompany.myapp.service.dto.ADTO
[ERROR] src/main/java/com/mycompany/myapp/service/dto/ADTO.java:[56,22] cannot find symbol
symbol: method getBId()
location: class com.mycompany.myapp.service.dto.ADTO
[ERROR] src/main/java/com/mycompany/myapp/service/BService.java:[50,24] cannot find symbol
symbol: method getAId()
location: variable bDTO of type com.mycompany.myapp.service.dto.BDTO
[ERROR] src/main/java/com/mycompany/myapp/web/rest/BResource.java:[56,32] cannot find symbol
symbol: method getAId()
location: variable bDTO of type com.mycompany.myapp.service.dto.BDTO
Related issues
Suggest a Fix
JHipster Version(s)
6.4.1
JHipster configuration
See JDL above
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
Windows 10
- Checking this box is mandatory (this is just to show you read everything)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (22 by maintainers)
Possibly related to the comment here: https://github.com/jhipster/generator-jhipster/issues/2899#issuecomment-200603494
@murdos I’m mixing comments, agrred 😉 but the fix is the same. I’ll do my best to close them before v6.5.0
This one. The other one isn’t blocking.
The obvious fix is to release a new version, which I will do very very very soon. Like before the end of the week (hopefully)