Yes. ObjectBox comes with strong relation support and offers features like “eager loading” for optimal performance.
The ObjectBox plugin only looks for entities in the current module, it does not search library modules. However, you can have a separate database (
MyObjectBox file) for each module. Just make sure to pass different database names when building your BoxStore.
It depends. Internally and in the C API, ObjectBox does zero-copy reads. Java objects require a single copy only. However, copying data is only a minor factor in overall performance. In ObjectBox, objects are POJOs (plain objects), and all properties will be properly initialized. Thus, there is no run time penalty for accessing properties and values do not change in unexpected ways when the database updates.
No. The objects you get from ObjectBox are POJOs (plain objects). You are safe to pass them around in threads.
It depends. In most cases no IO operations (which is what ObjectBox does) should be run on the main thread. This avoids (even rare) hangs of your app.
However, in some cases it might be alright. While ObjectBox and the underlying OS and file system can give no hard guarantees, reading (e.g. Box.get(id)) small amounts of data is typically very fast and should have no noticable impact on observed performance of your app. This is because in ObjectBox reads, unlike writes, are not blocked by other operations.
ObjectBox supports Android 4.0.3 (API level or minimum SDK 15) and above and works on most devices (armeabi-v7a, arm64-v8a, x86 and x86_64). It works with Java and Kotlin projects.
ObjectBox also runs on Linux (64 bit), Windows (64 bit), macOS and iOS with support for Kotlin, Java, Go, C, Swift and Python.
Yes, you can ObjectBox on the desktop/server side. Contact us for details if you are interested in running ObjectBox in client/server mode or containerized!
Generally speaking: Yes. You can run the ObjectBox database on any IoT device that runs Linux. We also offer Go and C APIs.
If you only do a rename on the language level, ObjectBox will by default remove the old and add a new entity/property. To do a rename, you must specify the UID.
The Google Play download size increases by around 2.0 MB (checked for ObjectBox 2.5.0) as a native library for each supported architecture is packaged. If you build multiple APKs split by ABI or use Android App Bundle it only increases around 0.5 MB.
The raw file (APK or AAB) size increases around 5.3 MB. This is because ObjectBox adds
extractNativeLibs="false" to your
AndroidManifest.xml as recommended by Google. This turns off compression. However, this allows Google Play to optimally compress the APK before downloading it to each device (see download size above) and reduces the size of your app updates (on Android 6.0 or newer). Read this Android developers post for details. It also avoids issues that might occur when extracting the libraries.
If you rather have a smaller APK instead of smaller app downloads and updates (e.g. when distributing in other stores) you can override the flag in your
<application...// not recommended, increases app update sizeandroid:extractNativeLibs="true"tools:replace="android:extractNativeLibs"...</applicaton>
More importantly, ObjectBox adds little to the APK method count since it’s mostly written in native code.
Yes. ObjectBox stores all data in a single database file. Thus, you just need to prepare a database file and copy it to the correct location on the first start of your app (before you touch ObjectBox’s API).
The database file is called
data.mdb and is typically located in a subdirectory called
objectbox (or any name you passed to BoxStoreBuilder). On Android, the DB file is located inside the app’s files directory inside
objectbox/<yourname> if you assigned the custom name
<yourname> using BoxStoreBuilder.
To reclaim disk space,
BoxStore and delete the database files using
BoxStore.deleteAllFiles(objectBoxDirectory). To avoid having to close
BoxStore delete files before building it, e.g. during app start-up.
// If BoxStore is in use, close it first.store.close();BoxStore.deleteAllFiles(new File(BoxStoreBuilder.DEFAULT_NAME));// TODO Build a new BoxStore instance.
Questions not related to Java, Kotlin or Android are answered in the general ObjectBox FAQ.
If you believe to have found a bug or missing feature, please create an issue. https://github.com/objectbox/objectbox-java/issues
If you have a usage question regarding ObjectBox, please post on Stack Overflow. https://stackoverflow.com/questions/tagged/objectbox