1 year ago

#193476

test-img

Malhotra

Android Room: Query returns null in Embedded field

Hi I am using Room DB and inserting a primary key and two embedded fields in a table. While trying to get the data from that table. That embedded fields returning null.

Table be like:

@NonNull
    @PrimaryKey
    @ColumnInfo(name = "ID", defaultValue = "0")
    private int ID;

    @Embedded
    private ArrayList<Attachments> Attachments;
    @Embedded
    private ArrayList<Fields> Fields;

and the query used to get data in DAO

 @Query("SELECT * FROM Data")
    List<Data>  getAll();

And call from Activity :

data= DatabaseClient.getInstance(getApplicationContext()).getAppDatabase().data().getALL();

Please help me on this!

android

android-room

android-room-prepackageddatabase

android-room-embedded

0 Answers

Your Answer

Accepted video resources