I have a Jhipster web application, and I have a (native jhipster) rest GET API Resource, returning a ResponseEntity<List> data which are converted to JSON on frontend (for the native webpage generated by Jhipster).
On the model, I have a 2 level relationship : Father => Son => Grandson
And I would like to have the JSON returning the name of the father but I cant.
Example :
When the rest API is called to have the list of grandson, the result is :
[{
id: 1,
name: Joe
son: {
id: 1,
name: Robert
}
},
...
]
But I would like to have :
[{
id: 1,
name: Joe
son: {
id: 1,
name: Robert
father: {
id: 777,
name: Alfonse
}
}
},
...
]
I tried many different techniques but didn't manage to do it simply and still do not have a solution.
Has anyone of you encountered this and have a solution ?
Thank you very much
I tried to add a transient field "fatherName" in the "grandson" java model. With the getter returning the son.father.name and it worked but then I had a problem with the sort mecanism of the table because all the mecanisme of criteria and pageable parameters upto the repository JPA Spring could not work.