Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with jdl relationships between default User jhipster entity #110

Closed
Zahma opened this issue Mar 13, 2020 · 8 comments
Closed

Problem with jdl relationships between default User jhipster entity #110

Zahma opened this issue Mar 13, 2020 · 8 comments
Labels
bug Something isn't working v1.0.0 First stable version
Milestone

Comments

@Zahma
Copy link

Zahma commented Mar 13, 2020

Describe the bug
Generated code is not running because of one to one relationship with the entity user I guess.

To Reproduce

  1. Generate code with the following JDL:

entity ExtendOne {

}

entity ExtendTwo {

}

relationship OneToOne {
ExtendOne{user(login) required} to User,
ExtendTwo{user(login) required} to User,
}

  1. Start the app

Expected behavior
Getting the following error:
` return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/domain/extendOnet.entity.ts:6:8 - error TS1192: Module '"D:/dev/Projet_Mehdi/S/server/src/domain/user.entity"' has no default export.

6 import User from './user.entity';
~~~~
src/domain/extend-one.entity.ts:55:20 - error TS2339: Property 'extendOne' does not exist on type '{}'.

55 other => other.extendOne`

@ghost
Copy link

ghost commented Mar 14, 2020

Hi @Zahma thanks for the feedback!
Maybe your jdl is wrong... you cannot do relationship with the dafault jhipster user.
Infact, in the running is logged a warn:

warn: An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.

However, I will try to resolve it with a good workaround. Thank you a lot!

@ghost ghost changed the title Problem with JDL generation Problem with jdl relationships with default User entity Mar 14, 2020
@ghost ghost added the bug Something isn't working label Mar 14, 2020
@ghost ghost changed the title Problem with jdl relationships with default User entity Problem with jdl relationships between default User jhipster entity Mar 14, 2020
@ghost ghost added this to the 1.0.0 milestone Mar 14, 2020
@ghost ghost added the v1.0.0 First stable version label Mar 14, 2020
@Zahma
Copy link
Author

Zahma commented Mar 14, 2020

Thank you, In fact the relationship points towards Users and not the opposite . So normally the relationship should be kept. Otherwise, do you know of a good idea to extend user entity ? In Jhipster we used to add the "mappedBy" in the user domain.

@MathieuAA
Copy link
Member

The JDL is okay (except I don't get the two relationships, but I guess it's just an over-simplified sample).
Looks like a genuine compilation issue due to what's been generated, but it's weird: I could have sworn this use-case is supported in JHipster (without blueprint I mean)

@ghost
Copy link

ghost commented Mar 14, 2020

Maybe I have resolved this in: https://github.com/jhipster/generator-jhipster-nodejs/tree/bug/110

You can download and link locally that for testing. For me it works. Thanks a lot

@ghost
Copy link

ghost commented Mar 14, 2020

The JDL is okay (except I don't get the two relationships, but I guess it's just an over-simplified sample).
Looks like a genuine compilation issue due to what's been generated, but it's weird: I could have sworn this use-case is supported in JHipster (without blueprint I mean)

Yes, I have fixed it.

@Zahma
Copy link
Author

Zahma commented Mar 14, 2020

I'll try and let you know ;)

@ghost
Copy link

ghost commented Mar 14, 2020

I'll try and let you know ;)

Sweet, thanks!

@ghost
Copy link

ghost commented Mar 23, 2020

I have retested it. So, in order to release, I consider this close. If you have other request please open a new issue. Thanks

@ghost ghost mentioned this issue Mar 23, 2020
@ghost ghost closed this as completed Mar 23, 2020
@ghost ghost mentioned this issue Mar 24, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.0.0 First stable version
Projects
None yet
Development

No branches or pull requests

2 participants