Generator-jhipster: Regenerating entity as readOnly in a gateway application causes compile errors

Created on 10 Sep 2020  路  2Comments  路  Source: jhipster/generator-jhipster

Overview of the issue


I am developing application in microservices architecture with JHipster Registry, UAA, gateway, etc.
I have generated application components with JHipster generator from command line.
I had an entity generated with readOnly property set to false, let's call it Message. I ran entity generation also in the gateway application's folder for the webapp (I am using React). Later I changed the readOnly property to true, re ran generation for the microservice and also for the gateway. At this point I got compile errors stating that createEntity, deleteEntity, updateEntity is missing from the reducer, see below:

 ERROR  Failed to compile with 6 errors 
  error  in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-delete-dialog.tsx                                   
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-delete-dialog.tsx(10,21):                             
 TS2614: Module '"./message.reducer"' has no exported member 'deleteEntity'. Did you mean to use 'import deleteEntity from "./message.reducer"' instead?
  error  in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx                                          
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx(10,21):                                    
 TS2614: Module '"./message.reducer"' has no exported member 'updateEntity'. Did you mean to use 'import updateEntity from "./message.reducer"' instead?
  error  in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx                                          
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx(10,35):                                    
 TS2614: Module '"./message.reducer"' has no exported member 'createEntity'. Did you mean to use 'import createEntity from "./message.reducer"' instead?
    1176 modules                                                                                                                                        
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-delete-dialog.tsx                                     
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-delete-dialog.tsx(10,21):                             
 TS2614: Module '"./message.reducer"' has no exported member 'deleteEntity'. Did you mean to use 'import deleteEntity from "./message.reducer"' instead?
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx                                            
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx(10,21):                                    
 TS2614: Module '"./message.reducer"' has no exported member 'updateEntity'. Did you mean to use 'import updateEntity from "./message.reducer"' instead?
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx                                            
 ERROR in D:/_development/todo-app/gateway/src/main/webapp/app/entities/eventuate/message/message-update.tsx(10,35):                                    
 TS2614: Module '"./message.reducer"' has no exported member 'createEntity'. Did you mean to use 'import createEntity from "./message.reducer"' instead?
##### **Motivation for or Use Case** Gateway webapp won't compile without manual delete of files from the source ##### **Reproduce the error** 1. Create entity with readOnly set to false 2. Run entity generation for the gateway 3. Change readOnly to true, regenerate in microservice 4. Run regenerate for the gateway ##### **Related issues** ##### **Suggest a Fix** Delete whole folder for the entity before regeneration in the gateway ##### **JHipster Version(s)** 6.10.1 ##### **JHipster configuration** ##### **JHipster Version(s)**
[email protected] D:\_development\todo-app\gateway
`-- [email protected]

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "hu.evopro.todo.gateway",
      "microservicePath": "..\\eventuate"
    },
    "jhipsterVersion": "6.10.1",
    "applicationType": "gateway",
    "baseName": "TodoGateway",
    "packageName": "hu.evopro.todo.gateway",
    "packageFolder": "hu/evopro/todo/gateway",
    "serverPort": "8080",
    "authenticationType": "uaa",
    "uaaBaseName": "TodoUAA",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "journal",
    "clientThemeVariant": "primary",
    "creationTimestamp": 1598519646183,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": false,
    "blueprints": []
  }
}

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


JDL entity definitions


Environment and Tools

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

git version 2.24.1.windows.2

node: v12.17.0

npm: 6.14.4

yeoman: 3.1.1

yarn: 1.21.1

Docker version 19.03.13-beta2, build ff3fbc9d55

docker-compose version 1.27.0, build 980ec85b

Entity configuration(s) entityName.json files generated in the .jhipster directory

Message.json

{                                   
  "fluentMethods": true,            
  "clientRootFolder": "eventuate",  
  "relationships": [],              
  "fields": [                       
    {                               
      "fieldName": "id",            
      "fieldType": "String"         
    },                              
    {                               
      "fieldName": "destination",   
      "fieldType": "String"         
    },                              
    {                               
      "fieldName": "headers",       
      "fieldType": "String"         
    },                              
    {                               
      "fieldName": "payload",       
      "fieldType": "String"         
    },                              
    {                               
      "fieldName": "published",     
      "fieldType": "Integer"        
    },                              
    {                               
      "fieldName": "creationTime",  
      "fieldType": "Integer"        
    }                               
  ],                                
  "changelogDate": "20200829115318",
  "dto": "no",                      
  "searchEngine": false,            
  "service": "no",                  
  "entityTableName": "message",     
  "databaseType": "sql",            
  "readOnly": true,                 
  "jpaMetamodelFiltering": false,   
  "pagination": "no",               
  "microserviceName": "eventuate"   
}                                   
Browsers and Operating System


Windows 10 1809
Firefox 80.0.1

  • [x] Checking this box is mandatory (this is just to show you read everything)
entities

Most helpful comment

A 1st answer after reading your ticket. I didn't test it yet.

I think the behavior is normal:

  • 1st time: you generate entity with default CRUD (readonly=false)
  • 2nd time: you changed option, when regenerate with readonly=true
  • the old files should be still there, you need to delete them manually

It's exactly the same workflow:

  • you generate with Elasticsearch option
  • then, later, you decide to change the option and remove Elasticsearch from config .yo-rc.json
  • you need to manually remove Elasticsearch files

All 2 comments

A 1st answer after reading your ticket. I didn't test it yet.

I think the behavior is normal:

  • 1st time: you generate entity with default CRUD (readonly=false)
  • 2nd time: you changed option, when regenerate with readonly=true
  • the old files should be still there, you need to delete them manually

It's exactly the same workflow:

  • you generate with Elasticsearch option
  • then, later, you decide to change the option and remove Elasticsearch from config .yo-rc.json
  • you need to manually remove Elasticsearch files

We don鈥檛 support changing configs now.
You need to recreate.
The only use case that removes file now is a deleted file from templates or renamed file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chegola picture chegola  路  4Comments

SudharakaP picture SudharakaP  路  3Comments

marcelinobadin picture marcelinobadin  路  3Comments

pascalgrimaud picture pascalgrimaud  路  3Comments

trajakovic picture trajakovic  路  4Comments