Closed RamiSouai closed 11 months ago
This is still an issue as of v7.9.3
I should also add that this only occurs when using Angular. React and Vue generate the models correctly.
Can confirm. Any fix planned?
Hi,
Expected since the very beginning of the project due to N+1 fetch and performance. There's no UI component that displays the list thus not needed. Feel free to contribute, or at least to find an elegant solution that can remedy this issue to go further
Hi,
Expected since the very beginning of the project due to N+1 fetch and performance. There's no UI component that displays the list thus not needed. Feel free to contribute, or at least to find an elegant solution that can remedy this issue to go further
Thank you for your answer. Maybe we were doing something wrong in the project, but this use case was working until version 7.9.2. I tried displaying the list in a UI component and the property is still not generated. Am I missing something?
Reposting https://github.com/jhipster/generator-jhipster/pull/21117#issuecomment-1517828616:
The ownerSide is a sql term that is used to build the rest api.
IMO it should be removed from jdl and replaced with something else in every generator except sql.
ownerSide
is only required for bidirectional OneToOne relationships.
OneToMany and ManyToOne currently implies ownerSide
on the many side, but could be avoided by using a join table.
ManyToMany implies ownerSide
on both sides.
If we want the ownerSide
on the OneToMany, we should try a join table approach.
For regular updates/resync with jhipster platform releases, please follow that guildeline
Hi @mshima 👋
We investedigated the issue with support of @emilpaw.
TL;DR: You fixed in v7.9.3 a very old bug we accidentally rely on in our code base 🙈
The missing properties were never generated in the whole Java code, but in the frontend generated code and we use these properties. You fixed this in the Angular generator, when you upgraded the Angular version. While debuging/experimenting we found out that the Vue generator works for us and we tried to fix the Angular generator the same way. That lead to our wrong PR. Now we know that our attempt to "fix the problem" would reintroduce the bug you've fixed 😂 We think that maybe the Vue generator still has the bug and generates these properties as empty arrays. @emilpaw will file an issue because he can explain it way better than me.
So, you can close this issue 😬
@RamiSouai will close the PR: https://github.com/jhipster/generator-jhipster/pull/21117
Thanks @Weltraumschaf for the info
@Weltraumschaf thanks for the follow up. We can handle entity improvements during v8 cycle.
Overview of the issue
Hello, I have a JDL file containing a One-To-Many relationship (Using this basic example: https://www.jhipster.tech/jdl/relationships#basic-example) between two Entites Foo and Bar. You can find the JDL file below.
The resulting interfaces are as follows:
export interface IBar { id: number; foo?: Pick<IFoo, 'id'> | null; }
export interface IFoo { id: number; }
The Foo interface is missing the
bar?: IBar[]
property.Reproduce the error
Create a 1: or :1 relationship in a JDL file then run
jhipster jdl ./jdl-file.jdl
JHipster Version(s)
JHipster v7.9.3
JHipster configuration
.yo-rc.json file
JDL entity definitions
Environment and Tools
openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7) OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
git version 2.25.1
node: v16.15.0
npm: 8.5.5
Docker version 20.10.17, build 100c701
Docker Compose version v2.10.2
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryFoo.json
Bar.json
Browsers and Operating System