質問

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