Closed bojanabogicevic closed 11 months ago
Primary keys
When it comes to primary keys, after researching I have come to a conclusion that both options are valid but one has more pros than the other when we compare UUID and Long. It is still up for a debate.
Pros
Cons
It all depends on the purpose of the application being built. If there is a possibility that an app is going to be accessed by a different system, then UUID would be a way to go, or if we chose standard Long (less safe) we would need to not expose the primary keys in the URL of API endpoints. Which brings up the issue of another unique identifier column that would be used for API endpoint communication. AKA we should not store primary keys of one database in another database, but use for example UUID column (this is the case of using Long for primary keys).
Many-to-many
When it comes to many-to-many relationships and the question of creating its own classes. After researching I have come to a conclusion that separate classes need to be created if we see a possibility of additional columns being added later down the line. Where two classes need to be connected to the sub-entity by Many-to-one relationship.
nullable = false
.Conclusion:
I would create all the many-to-many relationship entities, because we are never sure if additional column will be added even if 5 years from now, and the loss of data cannot be undone and would damage the system, especially in environments like production. Better safe than sorry.
In order to complete issue #11 following analysis should be done: