greenDAO icon indicating copy to clipboard operation
greenDAO copied to clipboard

Explain why entities with relationships have 'active' methods

Open cherrydev opened this issue 8 years ago • 5 comments

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.

cherrydev avatar Jan 24 '17 22:01 cherrydev

I've noticed the same behaviour in compile 'org.greenrobot:greendao:3.2.2'

DOFandersolsen avatar Jun 26 '17 10:06 DOFandersolsen

@DOFandersolsen Note that this is not a bug. The above is a change request. It is currently working as intended. -ut

greenrobot-team avatar Jun 26 '17 12:06 greenrobot-team

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

DOFandersolsen avatar Jun 28 '17 11:06 DOFandersolsen

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 avatar Jul 29 '19 08:07 vicgrad

@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.

greenrobot-team avatar Aug 06 '19 11:08 greenrobot-team