Is it necessary to create junction entities  in many to many relationship.

Please have a look, I have a product and order table and want to create a many to many relationship. Can i create many to many relationship without junction entity please check the below images for the same. Also please explain what is the difference in below both the relationship.



Hi Vandana, 

In Outsystems it is must to create/use third entity for many-to-many relationship. In your case, you have created a circular dependency, which is a bad practice and probably OS will show error for this while inserting record if these fields are mandatory in both the entity. Just think, you wanna insert a record in Order so you need ProductId but there is no record in Product entity and vice versa.

Regards, 

Sanjay

Hi Vandana,

with No Junction you can only use a single Product once.

I.e. Product "Chair" is only related to a single Order.

Regards

Hi Vandana, 

In Outsystems it is must to create/use third entity for many-to-many relationship. In your case, you have created a circular dependency, which is a bad practice and probably OS will show error for this while inserting record if these fields are mandatory in both the entity. Just think, you wanna insert a record in Order so you need ProductId but there is no record in Product entity and vice versa.

Regards, 

Sanjay

Hello Vandana, Yes, you can create M to M relationship without using a third/junction entity. But, not recommended in OutSystems. Creating a third entity will ensures that no same product will be added to the same order twice. If you do that, you will get an error. Regards, Abhinav

Hi Vandana,

Hope you are doing well.

To achieve M to M relationship you need to create junction entity, With No junction entity i.e. you have created  circular dependency in this entity you are not able to achieve the desired output, in out systems junction entity is must to achieve M to M relationship.

Thank you.

Have a Good Day.

mvp_badge
MVP

Hello there,

Your answer provides the exact same content that several other members already did.

Next time, please consider to read previous responses in order to avoid repeated answers and content.


Kind regards,

Rui Barradas

Hi Rui,

 I will take care of this next time.

Thank you.

Have a nice day

Rajeshree Chhablani.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.