Storing polymorphic objects in SQL database -
[noob warning!] I need to store some data in some tables where it is similar Is equal to the array of pointers for the polymeric object such as (pseudo C ++)
struct MyData {string name; } Struct MyDataA: MyData {int a, b, c; } Struct MyDataB: MyData {string s; } Maida * Data [100];
I really do not know what to enter Google Search! How will such information be stored in the SQL database?
My random thoughts:
- I have a table that is with a column that is the composition identifier and then it is unnecessary, but it seems useless .
- I can have a table for each structure type. In it there will be a foreign key back in the master array table, but how can I indicate the structure table?
This is a complex subject to get an idea of the strategies involved in it. I suggest reading Hibernate Docs on this topic:
Even if you are not using hibernate, then the relational mapping concept is still relevant. That hibernation does not control any single strategy because no one is better than another .
Comments
Post a Comment