Update some specific field of an entity in android Room -


i using android room persistence library new project. want update field of table. have tried in dao -

method 1:

@dao public interface tourdao {     @update     int updatetour(tour tour); } 

but when try update using method updates every field of entity matches primary key value of tour object. have used @query

method 2:

@query("update tour set endaddress = :end_address  id = :tid)      int updatetour(long tid, string end_address); 

it working long query in case because have many field in entity. want know how can update field(not all) method 1 id = 1;(id auto generate primary key).

entity:  @entity public class tour {     @primarykey(autogenerate = true)     public long id;     private string startaddress;     private string endaddress;     //constructor, getter , setter } 

i want know how can update field(not all) method 1 id = 1

use @query, did in method 2.

is long query in case because have many field in entity

then have smaller entities. or, not update fields individually, instead have more coarse-grained interactions database.

iow, there nothing in room seek.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -