Question

I started my work with greenDAO project, which I want to use to simplify database operation in my Android project. So, I would like to create a relation schema in seperated Java generator project.

My aim is to implement a superclass, from which other entities may inherit. Of course, I use a method:

myEntity.setSuperclass("MyCommonBehavior");

for each of inheriting entities. But the question is, how can I set a To-Many Relation to my main ("abstractive") model described in class, instead of setting To-Many Relation to each of specific entities?

Was it helpful?

Solution

GreenDAO doesn't support Polymorphism for now.

See their docs: Modelling Entities

" [...] Note: currently it’s impossible to have another entity as a super class (there are no polymorphic queries either)

Anyway, you could implement it yourself storing the entity type and some interfacing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top