jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Error in relationship with Authority Entity #14873

Closed yacosta738 closed 11 months ago

yacosta738 commented 3 years ago
Overview of the issue

It is possible to create relationships from user-generated entities to the built-in User entity, if a user wants to extend the user without modifying the actual user entity. The same thing is not possible to do with the Authority entity.

Reproduce the error

Generate a new project and import the jdl example:

entity Alpha
entity Beta
entity Gamma

relationship OneToOne {
    Alpha{authority(name)} to Authority
}

relationship ManyToOne {
    Beta{authority(name)} to Authority
}

relationship ManyToMany {
    Gamma{authority(name)} to Authority
}
Related issues

11062 #11158

jhipster import-jdl jdl-test.jdl


INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing import-jdl jdl-test.jdl
INFO! The JDL is being parsed.
INFO! Found entities: Alpha, Beta, Gamma.
INFO! The JDL has been successfully parsed
INFO! Generating 0 applications.
INFO! Generating 3 entities.
INFO! Generating entities for application undefined in a new parallel process

Found the .jhipster/Alpha.json configuration file, entity can be automatically generated!

Found the .jhipster/Beta.json configuration file, entity can be automatically generated!

Found the .jhipster/Gamma.json configuration file, entity can be automatically generated!

     info Creating changelog for entities Alpha,Beta,Gamma
Error running generator entities: Error: Error looking for otherEntity Authority
Error: Error looking for otherEntity Authority
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/generator-jhipster/generators/entity/index.js:530:19
    at Array.forEach (<anonymous>)
    at EntityGenerator.loadRelationships (/home/acosta/Projects/Desoft/SMRO/test/node_modules/generator-jhipster/generators/entity/index.js:526:36)
    at Object.<anonymous> (/home/acosta/Projects/Desoft/SMRO/test/node_modules/yeoman-generator/lib/index.js:1009:25)
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/run-async/index.js:26:19
    at runLoop.add.once.once (/home/acosta/Projects/Desoft/SMRO/test/node_modules/yeoman-generator/lib/index.js:1010:11)
    at Immediate.<anonymous> (/home/acosta/Projects/Desoft/SMRO/test/node_modules/grouped-queue/lib/subqueue.js:48:34)
    at processImmediate (internal/timers.js:461:21)
ERROR! Error looking for otherEntity Authority
Error: Error looking for otherEntity Authority
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/generator-jhipster/generators/entity/index.js:530:19
    at Array.forEach (<anonymous>)
    at EntityGenerator.loadRelationships (/home/acosta/Projects/Desoft/SMRO/test/node_modules/generator-jhipster/generators/entity/index.js:526:36)
    at Object.<anonymous> (/home/acosta/Projects/Desoft/SMRO/test/node_modules/yeoman-generator/lib/index.js:1009:25)
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /home/acosta/Projects/Desoft/SMRO/test/node_modules/run-async/index.js:26:19
    at runLoop.add.once.once (/home/acosta/Projects/Desoft/SMRO/test/node_modules/yeoman-generator/lib/index.js:1010:11)
    at Immediate.<anonymous> (/home/acosta/Projects/Desoft/SMRO/test/node_modules/grouped-queue/lib/subqueue.js:48:34)
    at processImmediate (internal/timers.js:461:21)
JHipster Version(s)
testas@0.0.0 /home/acosta/Projects/Desoft/SMRO/test
└── generator-jhipster@7.0.1 
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "blueprints": [],
    "otherModules": [],
    "applicationType": "monolith",
    "baseName": "testas",
    "jhipsterVersion": "7.0.1",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": [],
    "pages": [],
    "creationTimestamp": 1620181380554,
    "serviceDiscoveryType": false,
    "reactive": false,
    "authenticationType": "jwt",
    "packageName": "com.mycompany.myapp",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "vue",
    "withAdminUi": true,
    "clientTheme": "none",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "packageFolder": "com/mycompany/myapp",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "clientPackageManager": "npm",
    "clientThemeVariant": "",
    "languages": ["en"]
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment 18.9 (build 11.0.10+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode)

git version 2.31.1

node: v14.16.1

npm: 6.14.12

Docker version 20.10.6, build 370c28948e

docker-compose version 1.26.2, build eefe0d31

Browsers and Operating System

Operating System: Manjaro Linux KDE Plasma Version: 5.21.4 KDE Frameworks Version: 5.81.0 Qt Version: 5.15.2 Kernel Version: 5.10.32-1-MANJARO OS Type: 64-bit Graphics Platform: X11 Processors: 4 × Intel® Core™ i7-6500U CPU @ 2.50GHz Memory: 7.5 GiB of RAM Graphics Processor: Mesa Intel® HD Graphics 520

CGarces commented 3 years ago

Please read this https://www.jhipster.tech/user-entity/#possible-relationships Maybe you are lookign for


entity Alpha

relationship OneToOne {
  Alpha{internalUser} to User
}
yacosta738 commented 3 years ago

No, I need the relationship with Authority.

atomfrede commented 3 years ago

Would like to contribute the feature? It seems the stale PR was nearly done, just some edge cases regarding oauth open. Maybe you can start with the content in this PR: https://github.com/jhipster/generator-jhipster/pull/11158

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

DanielFran commented 3 years ago

Keep it open

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

DanielFran commented 2 years ago

@yacosta738 Can you confirm you are available to contribute with a PR?

yacosta738 commented 2 years ago

Sorry for now I can't take it. 😞

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days

laariche-khalid commented 8 months ago

Is there anything new about this functionality, it is very useful for several case studies. Thank you for taking note of this development, is there a way to contribute to this?

laariche-khalid commented 8 months ago

Please Keep it open 🙏

mshima commented 8 months ago

Fixed in https://github.com/jhipster/generator-jhipster/issues/22106. Not available in v7.1.0. There are information about customizations inside linked PRs. UI for angular only right now.