Objectbox database for Java / Kotlin 3.0

ObjectBox Android database for Java / Kotlin 3.0 + performance benchmarks

ObjectBox – the high performance Android database for Java / Kotlin – goes 3.0 ❤️ and apart from features. the dev team is also sharing CRUD performance benchmarks including MongoDB Realm and SQLite with Room. ObjectBox Database has been used by over 800,000 developers since the 1.0 release for Android and apart from Java / Kotlin for Android, the ObjectBox DB also has C/C++, Go, Flutter/Dart, Swift bindings now and a superfast Data Sync.

What is ObjectBox?

ObjectBox is a NoSQL ACID-compliant object database and an alternative to SQLite and Room. ObjectBox is optimized for fast object persistence on restricted devices, typically “embedded devices”, sometimes called “edge devices” like e.g. smartphones, IoT gateways, PoS systems, or Controlling Units. Because most applications today include any number of decentralized connected devices, ObjectBox also provides fast and easy access to decentralized edge data through an out-of-the-box Data Sync solution (Early Access).

New Java / Kotlin Data Query API

Similar to the ObjectBox Dart/Flutter Query API, the new Java / Kotlin Query API helps to create nested conditions:

In Kotlin, the condition methods are also available as infix functions. This can make queries easier to read:

Unique on conflict replace strategy

One unique property in an  @Entity can now be configured to replace the object in case of a conflict — onConflict — when putting a new object.

This can help when existing data is updated with a unique ID different from the ObjectBox ID. E.g. assume an app for downloading a set of playlists where each has a modifiable title (e.g. “My Playlist”) and a unique String ID (“jam-1”). If the title of “jam-1” has changed to e.g. “Old Playlist” when downloading an updated version of the playlists, just a single put with the new data will now be done. The existing object for “jam-1” is then deleted and replaced by the new version.

Built-in string array and map support

Two new property types are now supported out-of-the-box: string array and string map. The  containsElement condition allows looking for objects by a specific item contained in the array.

Kotlin Flow, Android 12 and more

Kotlin extension functions were added to obtain a Flow from a BoxStore or Query:

Data Browser has added support for apps targeting Android 12.

For details on all changes, please check the ObjectBox for Java changelog.

Room (SQLite), Realm & ObjectBox CRUD performance benchmarks

The Android database CRUD benchmark includes ObjectBox, SQLite 3.22.0 used with Room 2.3.0 and MongoDB Realm 10.6.1. ObjectBox outperforms MongoDB Realm and SQLite with Room across all four major database operations: Create, Read, Update, Delete.

Android database comparative benchmarks for ObjectBox, Realm, and Room

The benchmarks were run on a Samsung Galaxy S9+ (Exynos) mobile phone with Android 10. All tests were repeated 10+ times and no outliers were discovered. The results graph above depicts the averages. The benchmarking code is open source; check it out yourself.

A fast local database is more than just a “nice-to-have.” It saves device resources, so the resource-heavy operations are left with more CPU, Memory, and battery power. In addition, an edge database improves privacy and data ownership by design. This is because it allows you to keep more data locally with the device and user. It also results in reduced data transferral volumes that have a significant impact on sustainability.

Sustainable Data Sync

However, you might need to synchronize some data to a backend. Selective and efficient data synchronization, as well as reduced overhead, help reduce bandwidth strain and cloud / Mobile Network usage. This in effect lowers the CO2 emissions. If you are looking for an out-of-the-box solution, ObjectBox Data Sync is right for you.

Get started with ObjectBox for Java / Kotlin

If you want to get started with using the free ObjectBox Android database right away, check this getting-started article or this video tutorial. Or go directly to GitHub. Already an ObjectBox Android database user and ready to take your application to the next level? Check out ObjectBox Data Sync, which solves data synchronization for edge devices, out-of-the-box. It’s really very efficient and (you guessed it) superfast 😎

Spread the love
Posted in News and tagged , , .