Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jhipster: How to create a one-to-many relationship with user entity?

Tags:

jhipster

I have created my domain using jhipster-uml JDL script. Now I want to establish a O2M from User to an an existing entity (company). Is there a way to do that via a JDL script? The script would need to re-declare every entity the relationship needs. But these are existing entities, is there a switch to direct jhipster-uml to use the existing domain definition without the need to re-declare it again?

I just want to avoid using the Liquibase/Java manual setup.

like image 870
DhafirNz Avatar asked Mar 05 '16 05:03

DhafirNz


1 Answers

In the documentation

Tip: the User entity

Please note that the User entity, which is handled by JHipster, is specific. You can do many-to-one relationships to this entity (a Car can have a many-to-one relationship to a User). This will generate a specific query in your new entity repository, so you can filter your entity on the current security user, which is a common requirement.

It seems only many-to-one relations can be generated with the User entity via the sub-generator. I don't know the UML tool but I guess it just use subgenerators under the hood.

You might need to do the relation manually

See also In JHipster how to create entity with relationship with User?

like image 132
luso Avatar answered Oct 10 '22 16:10

luso