Green DAO vs ORM lite vs Active Android [closed]

2019-01-30 17:52发布

问题:

Which is the best ORM tool available for Android?

I am seeing ORMlite and ActiveAndroid are the most discussed across and a friend of mine suggested me to use GreenDAO. So looking for some knowledge resource which can help me in Decision Making?

Features I am looking to judge are freely available (open source), good documentation, active forums, stable version available, etc, which ever required for developer.

回答1:

I would suggest ORMlite its open source freeware & has good documentation also it support java as well as android.

It has good developer support & many application running on ORMlite (Including I have developed :) ).

check this comparison of ORMLite & Green DAO for your referance.



回答2:

A difference between ORMLite and GreenDAO is the usage of annotations. While ORMLite uses Annotations, GreenDAO does not, as described here.

Annotations used by ORMLite rely on reflection, which might impact performance especially on slower Android devices in a negative way. Would be interesting to see benchmarks comparing ORMLite and GreenDAO.



回答3:

One issue I have with a number of the libraries that I've used is that they require that their initialization take place in android.app.Application.onCreate(). I prefer that libraries allow me to do their initialization in a secondary thread, in a service, or after I have finished displaying the user interface.

I believe that Active Android has this 'problem', and ORMLite does not. I'm not sure about GreenDAO.

Whether it is really a problem depends on your application, but I will note that the docs for onCreate() say "Implementations should be as quick as possible (for example using lazy initialization of state) since the time spent in this function directly impacts the performance of starting the first activity, service, or receiver in a process."

Unrelated to that, I note that ActiveAndroid uses annotations, like ORMlite, but unlike GreenDAO which uses code generation.