Closed mraible closed 12 months ago
Duplicated of https://github.com/jhipster/generator-jhipster/issues/23917?
@mshima I tried both of these options in JDL, and neither one results in the user showing up in the list:
@RelationshipEagerLoad Points{user(login)} to User with builtInEntity
Points{user(login)} to @RelationshipEagerLoad User with builtInEntity
@mraible @mshima
In the entity list view, the backend returns related entities with only an id
field, but the frontend expects a different field.
Response JSON and relevant code are as follows:
Response:
[
{
"id" : 1,
"date" : "2023-10-29",
"exercise" : 6654,
"meals" : 10241,
"alcohol" : 9875,
"notes" : "tightly",
"user" : {
"id" : 1
}
},
]
employee.tsx:
<td>{points.user ? points.user.login : ''}</td>
I believe it should be points.user.id
, regardless of the JDL's {user(login)}
.
(My understanding is that the JDL's \<display field> only affects the details and update views.)
Display field is supposed to be eager loaded due to this condition. https://github.com/jhipster/generator-jhipster/blob/20b31a71ed2f413b6e28fc0c4e73daefb1e46d08/generators/base-application/support/prepare-entity.mts#L629
And eager load apis should be generated: https://github.com/jhipster/generator-jhipster/blob/3cdd7445bf31c131f6fd89686536f722c6ee76af/generators/server/templates/src/main/java/_package_/_entityPackage_/repository/_entityClass_Repository.java.ejs#L81
I've generated the project, react and probably vue does not eager load the list by default.
Overview of the issue
If I create an app with the following JDL and JHipster 8.0.0 RC1, it fails to display the user in the list screens. If I edit the item, the user is assigned correctly, and I can change it.
Motivation for or Use Case
If there is a relationship with a user, it should be displayed in the list screen.
Reproduce the error
Create a new app with the JDL above and add a couple of records. No user is displayed on the list screen, but one is selected in the edit screen.
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
Environment and Tools
openjdk version "21" 2023-09-19 OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15) OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
git version 2.39.3 (Apple Git-145)
node: v18.18.2 npm: 9.8.1
Docker version 24.0.6, build ed223bc
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions