greenDAO
greenDAO copied to clipboard
Explain why entities with relationships have 'active' methods
I've noticed that even if an entity is not configured to be 'active' (contain update(), refresh() etc methods) the annotation processor will generate those methods anyway if the entity contains a relationship. While it may be a limitation of GreenDAO that an entity must hold a reference to a DaoSession in order to resolve relationships, my preference would be that delete(), refresh() and update() not be exposed as public methods.
At the very least the annotation processor might give a warning if there are relationships on an entity and @Entity(active = true) hasn't been explicitly specified, in order to explain the discrepancy.
I've noticed the same behaviour in compile 'org.greenrobot:greendao:3.2.2'
@DOFandersolsen Note that this is not a bug. The above is a change request. It is currently working as intended. -ut
My bad 😅
It would still be nice to have the logic moved out of the entity so it is basically a POJO and let the developer handle the rest through the DAO classes
My problem with this is that I'm trying to migrate from a generator based project to an annotations setup and I cannot do it because the generated entities have the mydao reference, do not compile and cannot be processed by the gradle plugin.
I've followed this guide: http://greenrobot.org/greendao/documentation/updating-to-greendao-3-and-annotations/
@vicgrad Can you please open a new issue and post a code snippet for what you mean by have the mydao reference, do not compile and cannot be processed by the gradle plugin? Possible quick fix: rebuild your project.