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.25k stars 4k forks source link

Jhipster V794: Entity Creation Fails with Error : An error occured while running jhipster:entity#loadRelationShips #26018

Open MenAllen opened 2 weeks ago

MenAllen commented 2 weeks ago
Overview of the issue

I want to create two entities Owner and Car (see your documentation) Starting with Owner entity, I create a relation ship with other (non existing yet) entity Car. Your doc says you will have a warning but I got an error and the entity is not created

Motivation for or Use Case

Blocking point for dev

Reproduce the error

systematic error when creating an entity with foreign key

##### JHipster configuration**** INFO! Switching to JHipster installed locally in current project's node repository (node_modules)

    ÔûêÔûêÔòù ÔûêÔûêÔòù   ÔûêÔûêÔòù ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù   ÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù
    ÔûêÔûêÔòæ ÔûêÔûêÔòæ   ÔûêÔûêÔòæ ÔòÜÔòÉÔòÉÔûêÔûêÔòöÔòÉÔòÉÔòØ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔûêÔûêÔòù ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòÉÔûêÔûêÔòöÔòÉÔòÉÔòØ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔòÉÔòÉÔòØ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔûêÔûêÔòù
    ÔûêÔûêÔòæ ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòæ    ÔûêÔûêÔòæ    ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòöÔòØ ÔòÜÔûêÔûêÔûêÔûêÔûêÔòù     ÔûêÔûêÔòæ    ÔûêÔûêÔûêÔûêÔûêÔûêÔòù   ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòöÔòØ

ÔûêÔûêÔòù ÔûêÔûêÔòæ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔûêÔûêÔòæ ÔûêÔûêÔòæ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòÉÔòÉÔûêÔûêÔòù ÔûêÔûêÔòæ ÔûêÔûêÔòöÔòÉÔòÉÔòÉÔòØ ÔûêÔûêÔòöÔòÉÔòÉÔûêÔûêÔòæ ÔòÜÔûêÔûêÔûêÔûêÔûêÔûêÔòöÔòØ ÔûêÔûêÔòæ ÔûêÔûêÔòæ ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔòæ ÔûêÔûêÔûêÔûêÔûêÔûêÔòöÔòØ ÔûêÔûêÔòæ ÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔûêÔòù ÔûêÔûêÔòæ ÔòÜÔûêÔûêÔòù ÔòÜÔòÉÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòØ ÔòÜÔòÉÔòØ ÔòÜÔòÉÔòÉÔòÉÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòØ ÔòÜÔòÉÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòØ ÔòÜÔòÉÔòÉÔòÉÔòÉÔòÉÔòÉÔòÉÔòØ ÔòÜÔòÉÔòØ ÔòÜÔòÉÔòØ https://www.jhipster.tech Welcome to JHipster v7.9.4

JHipster Version(s)
jhipster-app@0.0.1-SNAPSHOT C:\Users\phili\Documents\Projets\JhipsterApp
ÔööÔöÇÔöÇ generator-jhipster@7.9.4
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "JhipsterApp",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "caffeine",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1714556423136,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.4",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["en"],
    "messageBroker": false,
    "microfrontend": false,
    "microfrontends": [],
    "monorepository": true,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.mycompany.myapp",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": [],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipCommitHook": true,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}

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

Environment and Tools

openjdk version "11.0.20.1" 2023-08-24 OpenJDK Runtime Environment Temurin-11.0.20.1+1 (build 11.0.20.1+1) OpenJDK 64-Bit Server VM Temurin-11.0.20.1+1 (build 11.0.20.1+1, mixed mode)

git version 2.40.1.windows.1

node: v18.15.0

npm: 9.4.2

Congratulations, JHipster execution is complete! Sponsored with ÔØñ´©Å by @oktadev.

mraible commented 2 weeks ago

Can you please provide the exact steps to reproduce the problem? Screenshots or commands executed are the best way for us to help you.

MenAllen commented 2 weeks ago

Hello , I followed the documentation: https://www.jhipster.tech/managing-relationships/#a-bidirectional-many-to-one-relationship

A bidirectional one-to-many relationship Let’s start with two entities, a Owner and a Car. A owner can have many cars, and a car can have only one owner.

So this is a one-to-many relationship (one owner has many cars) on one side, and a many-to-one relationship (many cars have one owner) on the other side:

Owner (1) <-----> (*) Car Note that after generating the entity, the generator will inform you that some errors occurred while generating the files. That’s normal as the destination entity has not yet been generated, so you can safely ignore this warning.

We will create the Owner first. Here are the relevant JHipster questions for the Owner:

jhipster entity Owner ... Generating relationships to other entities ? Do you want to add a relationship to another entity? Yes ? What is the name of the other entity? Car ? What is the name of the relationship? car ? What is the type of the relationship? one-to-many ? What is the name of this relationship in the other entity? owner

I think the issue is in the documentation: you can't create an entity with a relationship to another entity not created. I fixed my problem by declaring first Owener without relation ship, then created Car with relationship to Owner, then modified Owner to add the relationship to Car

OmarHawk commented 2 weeks ago

I think this was fixed with #25564.

You should try to reproduce with the latest version.