I've been struggling to get my relationships to be saved when I converted my application from a monolith to microservices. I can update them via the webapp but on refresh or viewing the database the change is not visible. Basically nothing happens even though the toast indicates that the edit was successful. I don't see any errors nor warnings in either the gateway and nor microservice logs.
The PUT update calls do have the selected owned entities:
organisation: {
"id": "f43d61b1-3ba5-4891-a252-a5e0d73e4bbc",
"name": "Nevada Wooden Principal",
"status": "synergize transmit Hybrid",
"location": "interactive incremental",
"headcount": 7182,
"parent": {
"id": null,
"name": null,
"status": null,
"location": null,
"headcount": null,
"parentId": null
},
"parentId": null
}
organisationId: null,
personalInfo: {
"id": "0b76be08-4cbf-408d-ab03-3ba9a3add15d",
"dateOfBirth": "2023-07-11",
"network": "Bicycle Uranium Integration",
"wallet": null
},
personalInfoId: null
But the GET read calls of the owner entity still have:
organisation: {
"id": null,
"name": null,
"status": null,
"location": null,
"headcount": null,
"parentId": null
},
organisationId: null,
personalInfo: {
"id": null,
"dateOfBirth": null,
"network": null,
"wallet": null
}
personalInfoId: null
I have tried with jhipster 7.9.3 , v7.x_maintenance, 8.0.0-beta.1, and latest version from main. But I did not find a similar bug being reported so I must be doing something wrong.
To get relationships to save for the monolith, I had to ensure I defined ids the same way for all my entities (id UUID). I tried this for microservices, and also relying on the default ids in all cases.
To get the application to generate and run correctly with microservices and the latest version of 8.0 I had to change from jwt default to ouath2 and from vue to react.
Here is my simplified jdl file:
application {
config {
applicationType gateway
authenticationType oauth2
baseName mynk
buildTool gradle
clientFramework react
clientTheme zephyr
devDatabaseType h2Memory
languages [en, fr]
nativeLanguage en
packageName ma.mynk.wallet
prodDatabaseType postgresql
serviceDiscoveryType consul
}
entities *
}
application {
config {
applicationType microservice
authenticationType oauth2
baseName walletService
buildTool gradle
devDatabaseType h2Memory
packageName ma.mynk.wallet.core
prodDatabaseType postgresql
serviceDiscoveryType consul
}
entities *
}
entity Wallet {
id UUID
phoneNumber String
tag String
firstName String
lastName String
email String
currency String
contractId String
}
entity PersonalInfo {
id UUID
dateOfBirth LocalDate
network String
}
entity Organisation {
id UUID
name String
status String
location String
headcount Integer
}
relationship OneToOne {
Wallet{personalInfo} to PersonalInfo
}
relationship ManyToOne {
Organisation{parent(name)} to Organisation
Wallet{organisation(name)} to Organisation
}
service * with serviceImpl
paginate * with pagination
I generate the application as follows:
jhipster jdl --skip-jhipster-dependencies --workspaces --monorepository ../docs/jdl/relationship.jdl
To run everything:
docker compose -f src/main/docker/consul.yml up -d
docker compose -f src/main/docker/keycloak.yml up -d
and then ./gradlew
under each microservice.
I was indeed missing the microservice
directive:
microservice * with walletService
I had read somewhere that it would be auto generated by listing the entities as part of the application (entities *
) but I must have misunderstood that.