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
Relation to User entity does not work on JHipster 8 beta #22844
Comments
Change your JDL to the following, and it should work:
|
Many at builtin User side is not supported. |
We should provide a better error message. |
@mraible Yes I followed the instructions in the error and got a different error. I still decided to include the code without " with builtInEntity" because it's closer to the documentation. |
thanks! |
Thanks so much ! |
Overview of the issue
I am trying to associate a post to the currently logged in user but I get errors when I try to generate entities. What I'm trying to do seems similar to examples I see online and the documentation.
Without the association entities will be added successfully and administration pages will be added to the app
https://www.jhipster.tech/user-entity/
Example jdl file
Error:
Following the advice from the error message I tried adding "with builtInEntity". Note, it is not mentioned in the documentation I found.
New error when re-running jhipster to update the admin panel:
ERROR! An error occured while running jhipster:bootstrap-application-base#prepareRelationshipsForTemplates
ERROR! ERROR! Error at entity Post: could not find the other side of the relationship {
"otherEntityName": "user",
"relationshipName": "user",
"relationshipSide": "left",
"relationshipType": "one-to-many",
"relationshipWithBuiltInEntity": true,
"otherEntity": "[User Entity]",
"ownerSide": false,
"otherEntityField": "id",
"relationshipLeftSide": true,
"relationshipRightSide": false,
"collection": true,
"otherSideReferenceExists": false,
"otherEntityIsEmbedded": false
}
Error: Error at entity Post: could not find the other side of the relationship {
"otherEntityName": "user",
"relationshipName": "user",
"relationshipSide": "left",
"relationshipType": "one-to-many",
"relationshipWithBuiltInEntity": true,
"otherEntity": "[User Entity]",
"ownerSide": false,
"otherEntityField": "id",
"relationshipLeftSide": true,
"relationshipRightSide": false,
"collection": true,
"otherSideReferenceExists": false,
"otherEntityIsEmbedded": false
}
at prepareRelationship (file:///C:/Users/daniel.popov/AppData/Roaming/npm/node_modules/generator-jhipster/dist/generators/base-application/support/prepare-relationship.mjs:83:19)
at BootstrapApplicationBase.prepareRelationshipsForTemplates (file:///C:/Users/daniel.popov/AppData/Roaming/npm/node_modules/generator-jhipster/dist/generators/bootstrap-application-base/generator.mjs:210:17)
at BootstrapApplicationBase.executeTask (file:///C:/Users/daniel.popov/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:240:26)
at env.queueTask.once (file:///C:/Users/daniel.popov/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:214:56)
at runLoop.add.once (C:\Users\daniel.popov\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-environment\lib\environment.js:1441:34)
at Immediate. (C:\Users\daniel.popov\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\grouped-queue\lib\subqueue.js:48:34)
at process.processImmediate (node:internal/timers:476:21)
ERROR! An error occured while running jhipster:bootstrap-application#prepareEntityDerivedProperties
ERROR! An error occured while running jhipster:bootstrap-application#postPreparingEntities
info KeyStore 'C:\dany\test\user-association-jhipster\src\main\resources\config\tls\keystore.p12' already exists. Leaving unchanged.
ERROR! An error occured while running jhipster:server#writeServerFiles
ERROR! An error occured while running jhipster:angular#writeEntitiesFiles
info Using existing git repository.
ERROR! An error occured while running jhipster:spring-data-relational#addTestSpringFactory
Motivation for or Use Case
I am trying to associate a post to the currently logged in user and generate the administration page for the app
Reproduce the error
Run
jhipster
Add and execute jdl file:
jhipster jdl jhipster-jdl.jdl
This should cause the 1st error
jhipster
The 2nd error should appear
JHipster Version(s)
Using JHipster 8 beta, the default installed by npm
I tried downgrading to 7.9.3 but the jhipster command wouldn't work at all after that
JHipster configuration
WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to JHipster v8.0.0-beta.1
Welcome to the JHipster Information Sub-Generator
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
Environment and Tools
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
git version 2.40.1.windows.1
node: v18.15.0
npm: 9.5.0
'docker' command could not be found
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Congratulations, JHipster execution is complete!
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryPost.json:
jhipster-jdl.jdl:
Browsers and Operating System
Windows 10 Chrome
The text was updated successfully, but these errors were encountered: