Don't recreate it, keep the DaoSession in application scope.
PS.: I'd be interested if you succeeded to improve your performance using greenDAO.
Question
I am working on a large project that involves many different applications communicating to the same database at the same time.
I have been changing our system over to using greendao
to see if it would give us performance improvements over Android ContentProvider
.
The question:
Every time that an application needs to communicate with the database, i have it getting a new DaoSession
and then performing the action. I am never re-using any DaoSessions
. Would it be better if each application had their own DaoSession
?
Keep in mind that i am concerned about concurrency between all these apps reading/writing from the database at the same time.
this.daoMaster.newSession().getMyDao().insert(myDao);
DaoSession
from somewhere
else and doing this:this.daoSession().getMyDao().insert(myDao);
Solution
Don't recreate it, keep the DaoSession in application scope.
PS.: I'd be interested if you succeeded to improve your performance using greenDAO.