generator-jhipster: “yo jhipster:entity” with one-to-one relationship does not create entity
Overview of the issue
I tried to add entity “blog” with relation one-to-one to fresh jhipster’s project, but no results, jhipster generator did not add the entity “blog” to my project.
$ yo jhipster:entity blog
The entity blog is being created.
Generating field #1
? Do you want to add a field to your entity? Yes
? What is the name of your field? name
? What is the type of your field? String
? Do you want to add validation rules to your field? No
================= Blog =================
Fields
name (String)
Generating field #2
? Do you want to add a field to your entity? No
================= Blog =================
Fields
name (String)
Generating relationships to other entities
? Do you want to add a relationship to another entity? Yes
? What is the name of the other entity? user
? What is the name of the relationship? user
? What is the type of the relationship? one-to-one
? Is this entity the owner of the relationship? Yes
? When you display this relationship with AngularJS, which field from 'user' do you want to use? id
? Do you want to add any validation rules to this relationship? No
================= Blog =================
Fields
name (String)
Relationships
user (User) one-to-one
Generating relationships to other entities
? Do you want to add a relationship to another entity? No
================= Blog =================
Fields
name (String)
Relationships
user (User) one-to-one
? Do you want to use a Data Transfer Object (DTO)? No, use the entity directly
? Do you want to use separate service class for your business logic? No, the REST controller should use the repository directly
? Do you want pagination on your entity? No
Everything is configured, generating the entity...
$
no error message, nothing. I tried add same entity by JDL - same result.
$ yo jhipster:import-jdl jhipster-jdl.jh
The jdl is being imported.
$
file jhipster-jdl.jh:
entity Blog {
name String
}
relationship OneToOne {
Blog{User} to User
}
JHipster Version(s)
ver JHipster Generator v3.4.2 tested on node v5.7.1, v4.4.6
JHipster configuration, a .yo-rc.json file generated in the root folder
{
"generator-jhipster": {
"jhipsterVersion": "3.4.2",
"baseName": "blog",
"packageName": "org.example",
"packageFolder": "org/example",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "no",
"clusteredHttpSession": "no",
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "postgresql",
"prodDatabaseType": "postgresql",
"searchEngine": "no",
"buildTool": "gradle",
"enableSocialSignIn": false,
"jwtSecretKey": "4ce955d288b7cf3e38b172a145c56f62c0f1eb1a",
"useSass": false,
"applicationType": "monolith",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}
Suggest a Fix
Workaround this problem - make 2 step :
- create entity without any relationship
- add one-to-one relation to this entity by “yo jhipster:entity”
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (15 by maintainers)
Commits related to this issue
- fix one-to-one relationships with User with entity as owner Fix #3773 — committed to ruddell/generator-jhipster by ruddell 8 years ago
- fix one-to-one relationships with User with entity as owner Fix #3773 — committed to ruddell/generator-jhipster by ruddell 8 years ago
Hi @ruddell I’m sorry I don’t have much time for the project at the moment, but yes I think you are right. Thanks for all your help -> would you like to join the dev team?