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

Pagination is not being generated #786

Open
1 task done
ivanmonteiro opened this issue Jul 1, 2021 · 5 comments
Open
1 task done

Pagination is not being generated #786

ivanmonteiro opened this issue Jul 1, 2021 · 5 comments
Labels
bug 🐞 Something isn't working

Comments

@ivanmonteiro
Copy link
Contributor

Overview of the issue

When I import entitities by JDL no pagination is generated, even with paginate * with pagination set in the JDL.
I'm using the main version of jhipster.net with angular as the frontend.

Motivation for or Use Case
Reproduce the error

Create a file named myapp.jdl with the following contents:

entity Employee {
    name String maxlength(20)
}

dto * with mapstruct
paginate * with pagination
service all with serviceImpl

and then run
jhipster import-jdl myapp.jdl

The generated ..jhipster/employee.json will contain "pagination": "no", instead of "pagination": "pagination".

Oddly, if I run jhipster import-jdl myapp.jdl --json-only the ..jhipster/employee.json will contain "pagination": "pagination" as expected. But when I try to re-generate the entity files with jhipster --with-entities pagination is set no "no" for unknown reasos. So pagination is not generated.

As @nicolas63 said it migh be a regression from upgrading to jhipster v7.

Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@ivanmonteiro ivanmonteiro added the bug 🐞 Something isn't working label Jul 1, 2021
@gatity
Copy link

gatity commented Jul 3, 2021

to generate pagination, I was forced to add "this.pagination='pagination';" in customizeDotnetPaths in utils.js file .
also when I add "dto * with mapstruct" it can't save one to many relationship in angular(for example location's country was not saved) .

@ivanmonteiro
Copy link
Contributor Author

to generate pagination, I was forced to add "this.pagination='pagination';" in customizeDotnetPaths in utils.js file .
also when I add "dto * with mapstruct" it can't save one to many relationship in angular(for example location's country was not saved) .

@gatity Could you create another issue for the one-to many relationship with more details?

@nicolas63
Copy link
Member

to generate pagination, I was forced to add "this.pagination='pagination';" in customizeDotnetPaths in utils.js file .
also when I add "dto * with mapstruct" it can't save one to many relationship in angular(for example location's country was not saved) .

@ivanmonteiro @gatity thanks for your help i look this soon

@eyzon
Copy link

eyzon commented Jan 13, 2023

I've faced the same problem using postgres for database , so I did some debugging and I've found that the constant value for the database in dotnetcore generator is 'postgres' but for generator-jhipster is 'postgresql'.
That causes the result to set the value for pagination always to 'no' at path :
.....\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\generator-jhipster\generators\entity\index.js
at line 400
// disable pagination if there is no database, unless it’s a microservice entity published by a gateway
if (
![SQL, MONGODB, COUCHBASE, NEO4J].includes(context.databaseType) &&
(context.applicationType !== GATEWAY || !this.entityConfig.microserviceName)
) {
this.entityConfig.pagination = NO_PAGINATION;
}

The problem now is that the constant value 'postgres' is repeatly used in many places to the code and is a little risky to replace it everywhere.
If a variable was used instead , like generator-jhipster does , it would resolved everything with just assign the correct value to the variable.

@djibythiaw
Copy link

Hello I face the same issue.

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

5 participants