I am using android room persistence library for my new project.
I want to update some field of table.
I have tried like in my Dao
-
// Method 1
You could try this, but performance may be worse a little:
@Dao
public abstract class TourDao {
@Query("SELECT * FROM Tour WHERE id == :id")
public abstract Tour getTour(int id);
@Update
public abstract int updateTour(Tour tour);
public void updateTour(int id, String end_address) {
Tour tour = getTour(id);
tour.end_address = end_address;
updateTour(tour);
}
}