I
I
Ilya Pavlovsky2016-02-17 16:54:18
Android
Ilya Pavlovsky, 2016-02-17 16:54:18

Android SQLite which ORM framework are you using?

Faced the problem of choosing a lightweight and fast ORM framework for the Android platform. Been using ORMLite for a long time. Faced the problem of the speed of work and the speed of deploying this framework in projects. To do this, I conducted a research of available and popular libraries for working with a database in Android, but even here everything is not so simple. I set myself a certain list of tasks as a basis: lightness, sqlite support, fast integration, high speed.
ORMLite - taken as a basis, because for a long time I was afraid to touch anything else
Pros:

  • Fast integration
  • Scalability
  • Flexibility in customization
Minuses:
  • Work in Runtime
  • Work speed
  • Redundancy and labor in writing DAO
DBFlow - I was intrigued by the ease of integration and a larger list of settings than in ORMLite
Pluses:
  • Fast integration
  • Flexibility in customization
  • Great list of settings
  • Working at compile time
  • Support for working with MVVM
Minuses:
  • The speed of work is lower than that of ORM
  • Very low speed of work (selection) with nested collections
Realm - bought into advertising
Pros:
  • Fast integration
  • Working at compile time
  • Very fast working speed
  • RxJava support
Minuses:
  • Flexibility in customization
  • Lack of autoincrement
  • Thread-safe (it is impossible to fetch elements from one thread for further use in another, without using RxJava)
  • Inability to override equals and toString in a db element
  • Undocumented pitfalls and limitations
  • Redundancy when using custom fields in a database object
  • Compatibility with SQLite (it seems like realm uses its own format, I did not find a reverse conversion from realm to SQLite format)

I didn’t even consider some ORMs in detail (Sugar ORM is difficult to deploy, and the speed of work leaves much to be desired, ActiveAndroid and GreenDAO are redundant due to DAO)
Based on this list, I would like to ask the opinions of other experts, are there any frameworks with functionality like DBFLow or ORMLite and the speed of Realm or native SQLite. Or is it worth reconsidering the choice of the above?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
georgeci, 2016-02-17
@TranE91

Previously used OrmLite. True, I did not notice any problems when writing DAO.
For GreenDAO there is a DAO class generator.
Here, either rely on reflection and get slow work or write them yourself, getting a lot of monotonous code.
Then used SQLBrite and DAO to it.
Now I use Stor.io for a change , but this is just a wrapper over SQLite, like SQLBrite without DAO.

I
Ilya Pavlovsky, 2016-02-17
@TranE91

Timings of work:
10_000 elements with nested 10 elements in each.
bcf0c98cb3934a13b5fbe37cb55e47ca.png

M
Makhach Imangazaliev, 2016-02-17
@ImangazalievM

Top 5 ORMs for Android

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question