How to check if data is inserted in Room Database : <p>I am using Room Database from the new Architecture components in my project.
I am adding some data through dao, but when trying to retrieve it I am not getting it. Can you please suggest me how to check whether the insert was successful or not? Below are the codes to help you understand the problem.</p>

<p>adding to database, I checked with debugger, this statement executed successfully.</p>

<pre><code>appContext.db.rallyDAO().addVehicleListItem(vehicle)
</code></pre>

<p>Getting null from database on this statement after insert.</p>

<pre><code>val v = appContext.db.rallyDAO().getVehicleListItem(it.vehicleID)
</code></pre>

<p>RoomDatabase</p>

<pre><code>@Database(entities = arrayOf(Rally::class, Route::class, CheckPoints::class, Vehicles::class, VehicleListItem::class), version = 1)
abstract class TSDRoom: RoomDatabase() {
    public abstract fun rallyDAO():RallyDAO
}
</code></pre>

<p>Inside DAO</p>

<pre><code>@Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addVehicleListItem(vehicleListItem:VehicleListItem)

    @Query("select * from vehicles_submitted where vehicle_id LIKE :vehicleID")
    fun getVehicleListItem(vehicleID:String):VehicleListItem
</code></pre>

<p>VehicleListItem Entity</p>

<pre><code>@Entity(tableName = "vehicles_submitted",
        foreignKeys = arrayOf(ForeignKey(entity = Rally::class,
                parentColumns = arrayOf("rally_id"),
                childColumns = arrayOf("rally_id"))))
class VehicleListItem {
    @PrimaryKey
    @ColumnInfo(name = "vehicle_id")
    @SerializedName("vehicle_id")
    var vehicleID : String = ""
    @ColumnInfo(name = "driver_id")
    @SerializedName("driver_id")
    var driverID : String = ""
    @ColumnInfo(name = "vehicle_name")
    @SerializedName("vehicle_name")
    var vehicleName : String = ""
    @ColumnInfo(name = "driver_name")
    @SerializedName("driver_name")
    var driverName : String = ""
    @ColumnInfo(name = "driver_email")
    @SerializedName("driver_email")
    var driverEmail : String = ""

    @ColumnInfo(name = "rally_id")
    @SerializedName("rally_id")
    var rallyID: String = ""

    @ColumnInfo(name = "is_passed")
    @SerializedName("is_passed")
    var isPassed = false

    @ColumnInfo(name = "passing_time")
    @SerializedName("passing_time")
    var passingTime:String=""
}
</code></pre>
