Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Created October 22, 2017 14:10
Show Gist options
  • Save AkshayChordiya/5e2adcaa80d2c733dd1e23386aeb6fce to your computer and use it in GitHub Desktop.
Save AkshayChordiya/5e2adcaa80d2c733dd1e23386aeb6fce to your computer and use it in GitHub Desktop.
User entity for relation - Room
@Entity(tableName = "users", , foreignKeys = arrayOf(
ForeignKey(entity = Address::class, parentColumns = arrayOf("id"), childColumns = arrayOf("address_id"))
)
data class User(
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
var name: String = "",
@ColumnInfo(name = "address_id")
var address: Long? = null,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment