Everything you need to move your database:
- Super fast: Our motivation for building ObjectBox was to provide the best possible performance. ObjectBox beats all the embedded databases we’ve tested (and that’s a lot). Details will follow.
- Object API: No more Rows, columns and SQL-ObjectBox is a mobile database for objects built from scratch (no ORM, no SQLite). The compact API is easy to learn and requires you to use only a fraction of SQLite’s code.
- QueryBuilder: With ObjectBox, you only need to query for objects with checks at compile time. As a result, you won’t have any more typos at run time.
- Object Relationships: Object references/relationships are built-in types; They are the reference of the machine. Reactivity: Simple and powerful response to changes in data. Use the Reaction data viewer in ObjectBox or integrate with RxJava.
- Multi-platform: ObjectBox already supports Android and regular Java (Linux and Windows). MacOS and iOS are the next platforms on the roadmap.
- Instant Unit Testing: With our multi-platform approach, you can run normal unit tests (Robolectric free, instrumented test free) on your desktop at the millisecond level.
- Powerful techniques: ACID properties and multi-version concurrency Control (MVCC) give you secure transactions and parallelism. ACID stands for atomic, Consitent, isolated, durable.
- Simple threads: Objects returned by ObjectBox work in all threads, with no strings attached. No manual mode migration: ObjectBox is responsible for adding, deleting, and renaming new object versions of properties.
- DaoCompat library: Already using greenDAO? This little helper library provides the familiar greenDAO API for ObjectBox.
- Testing: Since ObjectBox was in beta, we’ve run it on applications running over 150.000 monthly active users and thousands of devices. Of course, we have a lot of unit tests (> 1000 person tests).
Definition of ObjectBox
ObjectBox is a superfast object-oriented database with strong relation support. objectbox.io
What’s more , it supports Java & Kotlin too.
ObjectBox update [as of 11/08, 2017]
Latest version: 1.2.0 (2017/10/31)
Demo code using ObjectBox:
Playlist playlist = new Playlist("My Favorties");
playlist.songs.add(new Song("Lalala"));
playlist.songs.add(new Song("Lololo"));
box.put(playlist);
Gradle setupCopy the code
Add this to your root build.gradle (project level):
buildscript {
ext.objectboxVersion = '1.2.0'
repositories {
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
}
}
allprojects {
repositories {
maven { url "http://objectbox.net/beta-repo/"}}}Copy the code
And this to our app’s build.gradle (module level):
apply plugin: 'io.objectbox' // after applying Android pluginCopy the code
First steps
Prepare the BoxStore object once for your app, e.g. in onCreate in your Application class:
boxStore = MyObjectBox.builder().androidContext(this).build();
Create data object class @Entity, for example "Playlist". Then get a Box class for this entity class:
Box<Playlist> box = boxStore.boxFor(Playlist.class);Copy the code
The Box object gives you access to all major functions, like put, get, remove, and query.
For details please check the docs.
Objectbox. IO/documentati…