问题
I'm building a job finding website using Jhipster. Two of our main entities are 'candidate' and 'headHunter' They're both users of the app, so they both have account on the app.
We decided to make each entities have a "one to one" relationship with User entity.
On top of that, we created a 'userCustom' entity to manage commons fields. This entity also have a "one to one" relationship with User.
So when either a headHunter or a candidate create a new account on the website, i have to call a "save" on 3 services : user, userCustom and candidate/headHunter
My main problem is : To create the userCustom and the candidate/headHunter, i need the userId.
What is the cleanest way to do this ?
Should I call the save on user, then call a get to retrieve the userId and then make the save on the two other entity ?
Another more general question : With this kind of configuration, is it a good idea to create custom DTO/services for each configuration (user,userCustom,candidate // user,userCustom,headHunter) ? Or do i just need to customize my candidate and headHunter classes ?
来源:https://stackoverflow.com/questions/41984367/jhipster-extented-user-entity-and-account-creation