In this lesson we create our model class. This lesson is part of our android mvvm livedata CRUD course with Room.
This model class we will create will have the following functionalities and characteristics:

  1. It will represent our data object, our Scientist object.
  2. From it Room will generate our Table Schema.
  3. It will be serializable thus we will be able to pass it around across activities.

Furthermore it will have the following fields:

  1. ID
  2. Name
  3. Galaxy
  4. Star
  5. DOB

Video Lesson

Full Code

Here is the full code:


import androidx.annotation.NonNull;


@Entity(tableName = "ScientistTB")
public class Scientist implements Serializable {

    @ColumnInfo(name = "id")
    private String id;
    @ColumnInfo(name = "name")
    private String name;
    @ColumnInfo(name = "description")
    private String description;
    @ColumnInfo(name = "galaxy")
    private String galaxy;
    @ColumnInfo(name = "star")
    private String star;
    @ColumnInfo(name = "dob")
    private String dob;

    public String getId() {
        return id;
    public void setId(String id) { = id;
    public String getName() {
        return name;
    public void setName(String name) { = name;
    public String getDescription() {
        return description;
    public void setDescription(String description) {
        this.description = description;
    public String getStar() {
        return star;
    public void setStar(String star) { = star;
    public String getGalaxy() {
        return galaxy;
    public void setGalaxy(String galaxy) {
        this.galaxy = galaxy;
    public String getDob() {
        return dob;
    public void setDob(String dob) {
        this.dob = dob;
    public String toString() {
        return getName();