The question is : When does GreenDao update the sql database from the session cache?

Let say that I'm querying an existing entity out of the database and than change one of it properties(fields). The changes are performed without directing the sql database in anyway.

So - should I do update on the entity? When does GreenDao flush it's session cache into the database itself?

有帮助吗?

解决方案

What you describe sounds like JPA/Hibernate session cache. greenDAO doesn't have that. It is simpler. There are objects kept in memory and you always update them manually to the database.

Some more information (far from complete): http://greendao-orm.com/documentation/sessions/

其他提示

When one generates the GreenDAO code (Entities, DAOs, DaoSession....etc), the DAOs by default extend the AbstractDao class which has a variety of methods for updating the database when needed instead of keeping the update in memory for a while such as (update(T entity), refresh(T entity), updateInTrx(java.lang.Iterable entities)).

For more information check the AbstractDao javaDoc

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top