문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top