I have created First Entity with name "FirstEntity" with a field "name" of type String and ManyToOne Relationship with User entity. It was created successfully. When I tried creating second entity with name "SecondEntity" with a field "name" of type String and ManyToOne Relationship with "FirstEntity", its failing with this error:
`Everything is configured, generating the entity...
~~~
events.js:288
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'toLowerCase' of undefined
at Function.plural (C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modules\pluralize\pluralize.js:133:24)
at pluralize (C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modules\pluralize\pluralize.js:174:46)
at C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modulesgenerator-jhipstergenerators\entity\index.js:928:74
at Array.forEach (
at EntityGenerator.loadInMemoryData (C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modulesgenerator-jhipstergenerators\entity\index.js:877:39)
at Object.
at C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modules\run-async\index.js:47:25
at new Promise (
at C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modules\run-async\index.js:24:19
at C:\Users\anshu\OneDrive\Desktop\tcs work from home\jhipster pocnode_modules\yeoman-generator\lib\index.js:547:9
Emitted 'error' event on EntityGenerator instance at:
at Immediate.
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)`
~~~
I added a console.log on line 928 of node_modules/generator-jhipster/generators/entity/index.js
and following was printed:
~
{
relationshipName: 'firstEntity',
otherEntityName: 'firstEntity',
relationshipType: 'many-to-one',
relationshipValidateRules: undefined,
otherEntityField: 'id',
ownerSide: undefined,
useJPADerivedIdentifier: undefined,
otherEntityRelationshipName: undefined
}
~
I can guess otherEntityRelationshipName is undefined because of which it is throwing error.
Jhipster version: 6.7.1
.yo-rc.json file
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp"
},
"jhipsterVersion": "6.7.1",
"applicationType": "monolith",
"baseName": "jhipster",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8080",
"authenticationType": "session",
"cacheProvider": "caffeine",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "cerulean",
"clientThemeVariant": "primary",
"creationTimestamp": 1586358157593,
"testFrameworks": [],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": false,
"blueprints": []
}
}
entityName.json files generated in the .jhipster directoryUsing command line
Windows 10 OS
[how to check? ] Checking this box is mandatory (this is just to show you read everything)
I think it鈥檚 fixed on master.
It was not working on 6.8 version either... which is the right version to use? I first added this question on stackoverflow, with all the screenshots of entity creation, but got no proper response
You should try npm install jhipster/generator-jhipster#master to fix this bug.
After generating the project you probably can downgrade if you want;
npm install [email protected]
jhipster 鈥攚ith-entities
Closing.
@anshulcoolans880 if you manage to reproduce using master, please reopen.
On a side note, there are undefined values in what was logged.
@anshulcoolans880 please follow the issue template, otherwise we won't be able to reproduce the issue and fix it.
Probably duplicate of https://github.com/jhipster/generator-jhipster/issues/11520
Yup, good catch
Most helpful comment
You should try
npm install jhipster/generator-jhipster#masterto fix this bug.After generating the project you probably can downgrade if you want;