1

I have entities

 @Entity
    public class A {
        @PrimaryKey(autoGenerate = true)
        public long id;
        public String bFId;
        public List<B> bList;
    }

    @Entity()
    public class B {
        @PrimaryKey @NonNull
        public String id;
        public String oneCId;
        public List<C> cList;
    }

    @Entity
    public class C {
        @PrimaryKey @NonNull
        public String id;
        public String value;

    }

And I wrote this like a Relation

 public class AWithB extends A{
        @Relation(parentColumn = "id", entityColumn = "bId")
        public List<BWithC> bWithC;

    }

    public class BWithC {
        @Embedded
        public B b;

        @Relation(entity=C.class,parentColumn="bFId",entityColun="cid")
        public List<C> {}
    }

Is my relation wrong? And How to insert data And retrieve data this.I must to be used this relation.I cannot use another relation.Please help me.

Ptut
  • 47
  • 1
  • 9
  • room does not allowed object references. and its not full fledge orm. first of create individual entity and then use relation ship in between. please read below link https://developer.android.com/training/data-storage/room/referencing-data – mcd Jun 20 '18 at 04:59
  • Please help me how am i write this code. – Ptut Jun 20 '18 at 05:08

0 Answers0