I'm designing the app model (not necessarily the `...
# android
b
I'm designing the app model (not necessarily the
@Entity
-ies) with the help of the room docs. The thing is that in
one-to-many
scenario the parent knows nothing about the children plus every child has only an ID of the parent. However I absolutely have to have an
Ad
as well as the list of application results (not just ids, whole objects) in
AdEntry
. Is it possible to do so in Room?
every example I've seen out there have just primitives (I mean string, int etc) in the
@Entity
One solution would be to separate my
model
classess (diagram) from the actual
@Entity
-ies and just convert stuff on the go, but I would have to make a couple of additional database calls so this approach isn't very scalable
if it comes to the app architecture, it looks like this: (still working on it tho, it's not complete and may contain some bugs)
also I can't just annotate stuff with
@Embedded
as I need these things to be in separate tables
uhh so thanks to this blog now I know that I can just use
@Relation
in case of
AdEntry -- ApplicationResult
relation, still don't know what about the
AdEntry -- Ad
in other words, I want
Ad
to be embedded but in a separate table
j
I think you need to create a table Ad like you diagram shows.
I mean at the end of the day Room is just a ORM so it does convert to SQLite and its impossible to include a table as a row in a relational db. There is a concept of virtual table in SQLite but its different from table. It behaves like View