The first and last time I used Sugar ORM

In almost all of my projects I’m using greenDao  thus, for a recent one I decided to try Sugar ORM – another Object-relational mapping library. As  the project had a comprehensive size and didn’t need any fancy database stuff I choose Sugar ORM.

On the first sight it all seemed very easy and comfortable since you just need to add the gradle dependencies

compile 'com.github.satyan:sugar:?' 

and let every entity inherit SugarRecord plus some configuration entries in the AndroidManifest.xml setting the database version and name (although I would like the configuration to be in some separate file).


What on the firts sight seemed to be almost optimal turned out, not to be that perfect:

1. You must set com.orm.SugarApp as the ApplicationClass (or inherit fromit)

Thus, making it impossible to use another ApplicationClass.

2. Using Sugar ORM, property names are not available as constants

You need to set them up yourself and also watch out to convert CamelCase to sql_underscore_style.

3. Sugar ORM does not work with MultiDex (at least on older devices)

See github. Ok, might use the master-version-approach, but then you lose the advantes of the simple gradle dependencies. Even I’m not sure about this as I somewhere read about problems (with proguard?) when using multiple projects.


For me, these reasons are enough not to use Sugar ORM again and either check out  another ORM next time or just stick with greenDao as only the setup is a bit more complicated but imho seems to be more bulletproof.

Kommentar verfassen