Screen Shot 2020-02-16 at 12.10.33 AM.png,Screen S...
# android
f
Screen Shot 2020-02-16 at 12.10.33 AM.png,Screen Shot 2020-02-16 at 12.10.13 AM.png
h
over
planTypes
you should mark it as
@Embedded
it's kinda weird this primary key as a list, I'd remove this and try again
f
I already removed that it was an oversight
m
There is quite an useful documentation how to define relationships between objects: https://developer.android.com/training/data-storage/room/relationships In your case it looks like you have a
one-to-many
or
many-to-many
(if a PlanType can belong to different _Plan_s)
f
Thanks I would check it out tho I use the embedded keywords Wich embedded other fields together with
As one
k
Is “Plan type” basically a DB-stored constant configuration, or is it variable? Like are all “youngin” plan types going to have the exact same meal plan type, laundry plan type, room plan type? Or is “youngin” a specific customer who has selected a room type, laundry type, and meal plan type? I ask because I think the ideal schema would be different depending on this.
It’s going to use @Embedded either way, but the tables you create and join together would be different. If “youngin” plan type will always use “youngin” meal, laundry, etc. (and no other plan type will use youngin types), then you only need one table for that entire JSON you provided. In my opinion. It’s faster, no joins required, and the data would be normalized pretty thoroughly.