Generator-jhipster: Many-To-Many relationship with User

Created on 12 Jul 2016  Â·  6Comments  Â·  Source: jhipster/generator-jhipster

Overview of the issue

Unable to set up a Many-To-Many relationship with User entity

Motivation for or Use Case

Creating a Many-To-Many relationship using the User

JHipster Version(s)

3.4.2

JHipster configuration, a .yo-rc.json file generated in the root folder

.yo-rc.json

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

Team.json

Browsers and Operating System

Jhipster vagrant box

Reproduce the error

generate new project
generate entity
try and create the entity in the app selecting multiple users and save it

Suggest a Fix

Unsure

area

Most helpful comment

An easy workaround is to create an intermediate CustomUser entity that is one-to-one with User and then make your many-to-many with this entity.

All 6 comments

We do not support many to many with User entity yet so this is not a bug

@jdubois what do you think? Should we support this?

An easy workaround is to create an intermediate CustomUser entity that is one-to-one with User and then make your many-to-many with this entity.

I just tried it and it works. Of course that wasn't on purpose, it's just our code is so good :-)

There is just one limitation: the other entity must be the owner of the relationship (otherwise we would need to modify the user entity). And of course, if you want to delete a user, you will need to delete first the relationship (but that's normal, as the user isn't the owner of the relationship).

I'm documenting this (that will be quick) and close this.

Btw we should also document that one-to-one with user works as well :),
basically except one-to-many everything seems to work as long as User is
not the owner :)

Thanks & Regards,
Deepu

On Wed, Aug 10, 2016 at 9:29 PM, Julien Dubois [email protected]
wrote:

Closed #3827 https://github.com/jhipster/generator-jhipster/issues/3827
via jhipster/jhipster.github.io@94a1d5d
https://github.com/jhipster/jhipster.github.io/commit/94a1d5d26d9cb53de8175d0d5d3e5ab9204e53f1
.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/3827#event-751533618,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF72VmSX0gLVPqizNsdjyTPYFQ3Zpks5qefVVgaJpZM4JKCIO
.

Yes I'll do it, thanks for pointing this out.

Le 10 août 2016 6:52 PM, "Deepu K Sasidharan" [email protected] a
écrit :

Btw we should also document that one-to-one with user works as well :),
basically except one-to-many everything seems to work as long as User is
not the owner :)

Thanks & Regards,
Deepu

On Wed, Aug 10, 2016 at 9:29 PM, Julien Dubois [email protected]
wrote:

Closed #3827 <https://github.com/jhipster/generator-jhipster/issues/3827

via jhipster/jhipster.github.io@94a1d5d
94a1d5d26d9cb53de8175d0d5d3e5ab9204e53f1>
.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
3827#event-751533618>,
or mute the thread
ABDlF72VmSX0gLVPqizNsdjyTPYFQ3Zpks5qefVVgaJpZM4JKCIO>
.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/3827#issuecomment-238930112,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATVowLjjDB5LxwkFgYAy7yrls65RBo6ks5qegHkgaJpZM4JKCIO
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmedeldeeb25 picture ahmedeldeeb25  Â·  3Comments

marcelinobadin picture marcelinobadin  Â·  3Comments

sdoxsee picture sdoxsee  Â·  4Comments

SudharakaP picture SudharakaP  Â·  3Comments

lsadehaan picture lsadehaan  Â·  3Comments