如何使用“房间关系”获取其他pojo的列表

时间:2018-11-07 04:56:41

标签: android foreign-keys android-room

@Entity(tableName = "subscription")
data class Subscription(
    @PrimaryKey val planId: Int,
    @ColumnInfo(name = "plan_name") val planName: String? = null,
    @ColumnInfo(name = "plan_description") val planDescription: String? = null,
    @ColumnInfo(name = "plan_reg_fee") val planRegFee: String? = null,
    @ColumnInfo(name = "plan_monthly_charge") val planMonthlyCharge: String? = null
)


data class Benefit(
    @ColumnInfo(name = "benefit_id") val benefitId: Int? = null,
    @ColumnInfo(name = "benefit_code") val benefitCode: Int? = null,
    @ColumnInfo(name = "benefit_name") val benefitName: String? = null,
    @ColumnInfo(name = "benefit_status") val benefitStatus: String? = null
)

如何在“订阅”中获取福利列表,即

val benefitList: LiveData<List<Benefit>>? = null

使用房间关系

1 个答案:

答案 0 :(得分:0)

您可以从Google Documents中找到示例。 有一些有关“房间中的关系”的示例。