Hey Manikanth,
You might wanna look at this document,
https://docs.mendix.com/refguide7/generalization-and-1-1-association/
Hope it helps!
Hi Manikanth Sama,
Both inheritance and one-to-one associations have their advantages and disadvantages. Based on your situation you need to decide what is better for a particular entity.
There are, however, a few situations where a clear answer can be given:
Use one-to-one associations for entities with:
Use inheritance for entities:
Additionally you can find more information from this mendix document..
https://docs.mendix.com/refguide/generalization-and-association/
Hope this helps you.
Database - Inheritance
When one specialized entity is inherited from the generalized entity then the database only contains two tables, one table for each entity.
DataBase - One-One
When there is a one to one relation then the database contains 3 tables.
Performance
both options will have a different performance impact.
When dealing with inheritance, on the retrieve of a specialization, all data will be retrieved from two tables.
When dealing with a 1-1 association, only the queried entity data is retrieved, Associated data isn’t retrieved by default and thus there is a smaller impact on data transfer when retrieving only one of the two entities. However, if both entities are always retrieved, all three tables must be retrieved which is slower (Huge issue in performance) than the optimized two-table setup of inheritance.
With a 1-1 association, you only retrieve/change what you need, which is faster than an inheritance scenario when managing the entities individually. Inheritance will always retrieve/change from both entities.
Or do you always need both entities? If yes, then inheritance will be the best solution. Inheritance is better and quicker compared to a 1-1 association when retrieving both entities since the platform has optimized the retrieves and commits of the inheriting entities.
Conclusion:
Inheritance and 1-1 associations have their pros and cons. Thus, the best option is based on your needs and what is best for your situation. Here are a few questions that will help determine which to use: