I have two entities: A (X-module) and B (Y-module). Each resides in a separate eSpace/module. In the X-module, I consumed the Y-module to access B's entity actions. However, I needed entity A's primary key/identifier in entity B to establish a relationship, but I didn’t want both entities in the same module. Instead of consuming the X-module in the Y-module and referencing A's primary key in B, I created an attribute called AId to avoid circular references. I then populated this field with A's primary key.
In my mind, I believe I didn't create a formal relationship between the two entities, but I avoided the circular reference. What potential issues could this lead to in the future, if any?
U lost inferential integrity, like on delete cascade when the parent is deleted, etc. So many codes to maintain, instead of using database features.
regards
Hello,
With the current solution you applied you can't ensure data integrity and consistency. So you may add some values into AId of table B which is not existing into table A.
Also when you delete one record of AId if it has any records into table B it will continue using deleted Id.
The best solution here is to extract Table A at least or both A and B into new module and reference this module into both X module and Y module
Thank you abundantly.
Problems are what @Mostafa Othman is saying,
in the day to day usage, data integrity is not ensured, but it is also bad for software maintainability, this dependency is hidden from anybody doing work on the X module.
Let's assume you leave the A entity in the X and the B entity in the Y module, then let's rename your modules for better readability for anyone appliying the common naming standards
module X_CS :
module Y_CS
NEW module :
So there are no circular references now
Dorine
Thank you for your time and advice.
Is there a need for the two entities to be in a different module? They seem to be closely related which might pop the question why not put them in one module?
Thank you. I will consider having them in the same module.