我正在使用此post将数据插入到我的关系实体中,但是我不知道如何将数据插入对象我的pojo类中的数组列表对象中。
@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......
和我的数组列表值类。
@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....
和我的现场课程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")
我想将数据插入到字段pojo类中,但没有成功,不确定如何将数据插入到数组列表插入对象中的任何解决方案。