jhipster / jhipster-dotnetcore

JHipster.NET blueprint
Apache License 2.0
315 stars 93 forks source link

Pagination is not being generated #786

Open ivanmonteiro opened 3 years ago

ivanmonteiro commented 3 years ago
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
gatity commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 1 year ago

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 commented 1 year ago

Hello I face the same issue.