1

I am using this post for inserting data into my relation entity but i cannot figure out how to insert data into array list object inside object My pojo class like this.

@Entity(tableName = "idpDmo", indices = @Index(value = {"idpValue"}, unique 
= true))
public class IdpDemo implements Serializable {
@PrimaryKey()
@NonNull
@ColumnInfo(name = "primeryId")
private String uid;
@SerializedName("@odata.context")
@Expose
@ColumnInfo(name = "dataContext")
private String odataContext;
@SerializedName("value")
@Expose
@TypeConverters({Converters.class})
@Ignore
@ColumnInfo(name = "idpValue")
private LiveData<List<Value>> value = null;
Getter Setter Method......

and my array list value class.

@Entity(foreignKeys = @ForeignKey(entity=IdpDemo.class, parentColumns="id", 
childColumns="id"))
public class Value implements Serializable
{
@ColumnInfo
@PrimaryKey(autoGenerate = true)
Integer primeryId;

@SerializedName("@odata.etag")
@Expose
private String odataEtag;

@SerializedName("createdDateTime")
@Expose
private String createdDateTime;
@SerializedName("eTag")
@Expose
private String eTag;
@ColumnInfo(name = "id")
@SerializedName("id")
@Expose
@NonNull
@PrimaryKey
private String id;
@SerializedName("lastModifiedDateTime")
@Expose
private String lastModifiedDateTime;
@SerializedName("webUrl")
@Expose
private String webUrl;
@SerializedName("createdBy")
@Expose
@Ignore
private CreatedBy createdBy;

@SerializedName("lastModifiedBy")
@Expose
@Ignore
private LastModifiedBy lastModifiedBy;
@SerializedName("parentReference")
@Expose
@Ignore
private ParentReference parentReference;
@SerializedName("contentType")
@SerializedName("fields")
@Embedded
private Fields fields;
 Getter Setter method....

and my field class pojo.

@Entity()
public class Fields  implements Serializable {
@SerializedName("@odata.etag")
@Expose
private String odataEtag;
@SerializedName("id")
@Expose
@PrimaryKey()
@ColumnInfo(name = "fieldId")
private String id;
@SerializedName("ContentType")
@Expose
private String contentType;
@SerializedName("Title")
@Expose
private String title;
@SerializedName("Modified")
@Expose
private String modified;
@SerializedName("Created")
@Expose
@ColumnInfo
private String created;
@SerializedName("AuthorLookupId")
@Expose
private String authorLookupId;
@SerializedName("EditorLookupId")
@Expose
private String editorLookupId;
@SerializedName("_UIVersionString")
@Expose
private String uIVersionString;
@SerializedName("Attachments")
@Expose
private Boolean attachments;
@SerializedName("Edit")

I want to insert data into field pojo class but not succeeded, am not sure how to insert data into array list insert object any solution for that.

Subhash Pandey
  • 111
  • 1
  • 6

0 Answers0