Introducing DaoCompat: greenDAO on ObjectBox

Earlier this month, we released ObjectBox 1.0, a new superfast object-oriented database. Now, with DaoCompat, you can easily use the power of ObjectBox in your Android apps while keeping the greenDAO APIs.

Boost your App performance

DaoCompat lets your greenDAO-based apps run on ObjectBox giving your your apps an instant performance boost.

Going forward you can also use ObjectBox’ modernized APIs. It works with Kotlin and reactive queries (with or without RxJava 2). Also, object relationships are much more powerful with change tracking and intelligent updates.

For greenDAO users it is an easy switch: With DaoCompat you can continue to use familiar classes from greenDAO like DaoSession and individual DAOs. Just use the package org.greenrobot.daocompat instead of org.greenrobot.greendao. Initialization to get the DaoSession is also trivial:

Technically, DaoCompat is a thin layer on top of ObjectBox. It’s open source under the Apache 2 license.

Check the DaoCompat docs for details and let us know what you think.

The Future of greenDAO

Since greenDAO was released in 2011, it has been the performance leader in Android ORM and performance was always the primary driver behind greenDAO. Performance-wise, we hit a wall with SQLite because SQLite became the only remaining bottleneck. This is the very reason why we developed ObjectBox because we believe that the future of apps will not include SQLite. Still, we will continue to maintain greenDAO. At the same time we will put much more effort into ObjectBox and exciting new features around it. In that way, look at DaoCompat as a convenient tool to upgrade your database.

greenDAO 3.2.2 Bugfix Release

This week we released greenDAO 3.2.2 with a couple of bug fixes. We want to highlight better interoperability with the Android Gradle plugin. With each new release of Android Gradle plugin, there have been conflicts with greenDAO plugin as both use “JDT”, a library to parse and manipulate Java Sources. To solve those conflicts once and for all, we now ship the greenDAO plugin with a repackaged version of JDT. Thus we are independent of other tools and can use the latest JDT versions. For best developer experience, we recommend everybody to update to greenDAO 3.2.2.

greenDAO 3.2(.1) Release

With greenDAO 3.2.x we are improving Android studio compatibility. Actually, greenDAO 3.2.0 was already released a couple of weeks ago, without a notification post. The first 3.2 release aligned an internal dependency (JDT ) to work nicely with Android Studio 2.2. Also, it added Protocol Buffers support to annotations. Today we are releasing 3.2.1 for the greenDAO plugin. Note that the core greenDAO lib and the generator did not have to be updated and thus remain at V3.2.0. This plugin update further improves Android Studio and Jack compiler integration and fixes some bugs. Check the changelog for details.


SQLite access with an ORM – FAQ

What is an Object-Relational-Mapper (ORM)?

An ORM is a layer between the relational SQLite database and the object-oriented app code. The ORM allows the developer to use the database without the need to transform objects into a format suited for the relational database.

Do I need an ORM to work with SQLite?

Continue reading

greenDAO 3.1.1 Bugfix Release

Today, we released a new version of greenDAO addressing some issues with @Entity annotations. If haven’t tried them yet, please give them a try. We think this is the most convenient way to work with greenDAO, or SQLite in general. For details on the 3.1.1 improvements, please check the changelog.

Android ORM Performance 2016

With greenDAO 3 released, it’s time again to look at the Android ORM performance landscape and do some benchmarks. This time, we also tested newer ORMs for SQLite like DbFlow, requery, SQLDelight, and SquiDB. Also, we had an extensive look at benchmarks done by others. Let’s get started with our results:

Continue reading

greenDAO 3 released

We are happy to announce greenDAO Version 3 today. Since its initial release 5 years ago, greenDAO has always been the fastest ORM for Android. It was also the first ORM to apply code generation for maximum performance. With greenDAO 3, we made code generation much more convenient: by adopting entity annotations you can drop the generator project. In its place comes the all new Gradle plugin, which automatically triggers code generation at build time. Like that, you can simply use greenDAO 3 annotations on your entities:
Continue reading

keep your data safe with SQLCipher

Database Encryption for Android N: SQLCipher 3.5

SQLCipher 3.5.0 with support for Android N was released yesterday. Previous versions of SQLCipher linked to non-public Android libraries, a practice Google warned about earlier. Android N is getting stricter about linking to platform libraries. To comply with Android N, the SQLCipher authors did the necessary changes and also did a major code clean up. This results in a massive code reduction, as you can see in the following table:
SQLCipher 3.4
SQLCipher 3.5
AAR size
7.15 MB
2.87 MB
armeabi-v7a .so size
2.50 MB
1.43 MB
ICU size compressed / uncompressed
2.19 MB / 6.73 MB

That's really good news. Just by using the new version 3.5.0 of SQLCipher, you can reduce your APK size (and build/deployment time). Not just the binary .so files got smaller, also the big "icudt46l.dat" file was removed in 3.5.0.

To see the effect in an app, we took the greenDAO example app and compared the resulting sizes. Of course, the version using built-in SQLite is by far the smallest, but your APK may lose 4.4 MB if you were using a previous version of SQLCipher:

SQLCipher 3.4
SQLCipher 3.5
greenDAO Example APK size
70 KB
7.22 MB
2.80 MB
greenDAO Example size on device (Nexus 5x)
0,88 MB
17,89 MB
12.39 MB

We noticed one incompatibility with SQLCipher 3.5.x however. Android's SQLiteDatabase defines two additional collations:

In addition to SQLite's default BINARY collator, Android supplies two more, LOCALIZED, which changes with the system's current locale, and UNICODE, which is the Unicode Collation Algorithm and not tailored to the current locale.

Running SQL ORDER commands with "COLLATE LOCALIZED" does not work anymore starting with SQLCipher 3.5.0. That is the downside of the ICU (and ASOP code) removal.

So, what about greenDAO support for SQLCipher 3.5.x? greenDAO used "COLLATE LOCALIZED" in the QueryBuilder when specifying orders using string properties. To ensure compatibility with SQLCipher 3.5, we just released greendao-encryption V2.2.2 without the LOCALIZED collation.

greenDAO 3 Beta released

We just released greenDAO 3 beta: it makes the generator project optional and moves to Java annotations. Before the final release however, we want to get your feedback. In particular, we experimented with alternative annotation processing that gives greenDAO more power while it avoids byte code manipulation.Our goal with greenDAO3 is to put the developer in control over entity classes while augmenting the entity code with a little bit of generated code.

Continue reading