Manditory attributes as direct attributes or as new entity with an association to main entity

0
Hi,  I have a doubt that i have two attributes that is a menditory field. ie those two attributes will be filled everytime when an new object is created. But my main entity already have 50-60 attributes. So is it advisable to create a new entity and add a reference? or can we directly add those two attributes in new entity?    For performance wise and creating /editing/retriving objects wise which will be prefered? (we have 20k objects now and may increase to 200/300k or more in future) Could some one please confirm on this. Any reference documentation would be helpful. 
asked
2 answers
0

Hi Lokesh, 

It would be good to to create a new entity and add an one to one association between your new entity and your main entity 

answered
0

Thinking about what happens in the database, adding a new entity would create 2 new database tables:  the new entity and separate entity to maintain the one to one association.  In addition, during development you would need to ensure that the one to one association is always set and maintained.  

 

So for this domain model:

image.png

 

The following tables will be maintained in the database:

image.png

 

If I were making this decision, I would choose to add the attributes to the existing entity.  Seems more straightforward and likely to have better performance.

 

Maybe others from the community will have other thoughts about this question.

answered