android - Is it acceptable to store the one-to-many relationship in a single table, having child entities flattened into a string column? -


editing previous question, boils down this:

given following data structure (object composition):

enter image description here

is bad design, or acceptable, instead of 2 related tables, store sets of reminders string column of event table in serialized way (e.g. json):

enter image description here

given simplify application significantly?

the reasons why considering are:

  • i don't need flexibility of accessing reminders separately;
  • i need query reminders per event , process them in code (e.g. choose next 3 reminders based on time , weekday_flags — not trivial where clause);
  • in end need display list of events associated reminders stated above, ideally have dataset (cursor) size matching number of events can feed adapter, , not large join result needs further processing , re-indexing;
  • reminder entity small , not going have more fields in future, , there won't more 3-4 reminders per event, therefore storing them serialized string not size or migration concern.

as pointed out christophe beyls here, system's serialization/parceling mechanisms cannot used persist data because might change eventually. it's either json or custom lightweight delimited format.


Comments