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

Unexpected behavior when updating entities with the command "jhipster import-jdl app.jh" #821

Open
1 task done
sergrdz opened this issue Jul 28, 2021 · 3 comments
Open
1 task done
Labels
bug 🐞 Something isn't working

Comments

@sergrdz
Copy link

sergrdz commented Jul 28, 2021

Overview of the issue

When the command is executed, all the entities are updated and not only the one with changes.

Reproduce the error
  1. Create a microservice type application
  2. Import a file with the command "jhipster import-jdl app.jh"
  3. Make a change to an entity
  4. Import again with the command "jhipster import-jdl app.jh"
Suggest a Fix

The database type is set incorrectly in the file ".yo-rc.json", currently when generating a microservice with sqlite the file is generated as follows:

"databaseType": "sqllite",
"prodDatabaseType": "mysql",
"devDatabaseType": "h2Disk",

The correct thing should I think it should be, which is how it is generated in the java generator

"databaseType": "sql",
"prodDatabaseType": "mysql",
"devDatabaseType": "h2Disk",

When adjusting manually, entities with changes are already detected, but all entities are still updated.

JHipster Version(s)

3.0.1

Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@ivanmonteiro
Copy link
Contributor

Is the import-jdl behaviour different from the (java) jhipster?

Here is a quick snippet that I use as a work-around when I want to import only one entity by jdl:

jhipster import-jdl jdl.jh --json-only
jhipster entity EntityName --single-entity

About databaseType: I think this generator uses databaseType and ignores the others (prodDatabaseType and devDatabaseType) If I'm not mistaken.

@sergrdz
Copy link
Author

sergrdz commented Jul 28, 2021

I have a productive gateway with the Jhipster v6.10.1 version and only the affected entity is updated, I'm not sure if the behavior is maintained in the latest version.

It is correct that prodDatabaseType and devDatabaseType are ignored. I think if it is not used as in the base generator there may be incorrect behaviors, as in the case of pagination it is always set as NO_PAGINATION. And the files generated in the .jhipster folder always get a "no" in the "pagination" field, even if the definition says otherwise.

In this file you will find the validation
generator-jhipster / generators / entity / index.js

if (! [SQL, MONGODB, COUCHBASE, NEO4J] .includes (context.databaseType)) {
this.entityConfig.pagination = NO_PAGINATION;
}

@nicolas63
Copy link
Member

@sergrdz thanks for your feedback you are right this code

if (! [SQL, MONGODB, COUCHBASE, NEO4J] .includes (context.databaseType)) {
this.entityConfig.pagination = NO_PAGINATION;
}

introduce a bug i need to investigate to resolve it. In the meantime i think the command line suggested by @ivanmonteiro can help you

@nicolas63 nicolas63 added the bug 🐞 Something isn't working label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants