Java API

ObjectBox is an an easy to use, object-oriented lightweight database and a full alternative to SQLite.

This is the ObjectBox documentation for our Java API. We strive to provide you with the easiest and fastest solution to store and retrieve data. Your feedback on ObjectBox and this documentation is very welcome. Use the "Was this page helpful?" smiley at the end of each page or send us your comments to contact[at]objectbox.io - thank you! :)

ObjectBox Changelog

V2.3.4 - 2019/03/19

  • Avoid UnsatisfiedLinkError on Android devices that are not identifying as Android correctly

  • Fix displaying large objects in Object Browser 32 bit

  • Kotlin properties starting with "is" of any type are detected

  • Add objectbox-kotlin to dependencies if kotlin-android plugin is applied (previously only for kotlin plugin)

  • @BaseEntity classes can be generic

V2.3.3 - 2019/02/14

  • Fixed a bug introduced by V2.3.2 affecting older Android versions 4.3 and below

V2.3.2 - 2019/02/04

  • Potential work around for UnsatisfiedLinkError probably caused by installation errors mostly in alternative app markets

  • Support for Android Gradle Plugin 3.3.0: resolves deprecated API usage warnings.

V2.3.1 - 2019/01/08

Important bug fix - please update!

  • Fixed a corner case for Box.getAll() after removeAll() to return a stale object if no objects are stored

V2.3 - 2018/12/30

Improvements & Fixes

  • Query improvements: findIds and LazyList also consider the order; offset and limit for findIds

  • Improved 32 bit support: Windows 32 version officially deployed, fixed a corner case crash

  • Property queries for a boolean property now allow sum()

  • Added Box.isEmpty()

  • Supporting older Linux distributions (now starting at e.g. Ubuntu 16.04 instead of 18.04)

  • Fix for a corner case with Box.count() when using a maximum

  • Minor improvements to the ObjectBox code generator

  • Android: set extractNativeLibs to false to avoid issues with extracting the native library

V2.2 - 2018/09/27

Using @Unique for strings? Please update ASAP

  • Urgent fix: the unique check for string properties had false positives resulting in UniqueViolationException. This occurs only in combination with IndexType.HASH (the default) when hashes actually collide. We advise to update immediately to the newest version if you are using hashed indexes.

  • The release of new ObjectBox C API made us change name of the JNI library

    for better distinction. This should not affect you unless you depended on that (internal) name.

  • Improved compatibility with class transformers like Jacoco

  • Fixed query links for M:N backlinks

  • Improved error messages for the build tools

  • The Object Browser AAR now includes the required Android permissions

V2.1 - 2018/08/16

Minor Improvements & Fixes

  • Entity counts are now cached for better performance

  • Deprecated aggregate function were removed (deprecation in 1.4 with introduction of PropertyQuery)

  • Object browser hot fix: the hashed indexes introduced in 2.0 broke the object browser

  • Object browser fixes: filters with long ints, improved performance in the schema view

  • NPE fix in ToOne

  • Added a specific NonUniqueResultException if a query did not return an expected unique result

V2.0 - 2018/07/25

New Features/Improvements

  • Links and relation completeness and other features already announced in the 2.0 beta

  • Unique constraint for properties via @Unique annotation

  • Hash index: for strings the new default index is hash-based, which is more space efficient

  • Support for char type (16 bit)

  • RX lib deployed in JCenter

  • Rework of Query APIs: type safe properties (property now knows its owning entity)

  • Allow query conditions of links using properties (without parameter alias)

  • Query performance improvements when using order

  • Property based count: query for non-null or unique occurrences of entity properties (non-null and unique)

  • Additional query conditions for strings: "greater than", "less than", "in"

  • Added query conditions for byte arrays

  • Set query parameters for "in" condition (int[] and long[])

V2.0 beta – 2018/06/26

New Features/Improvements

  • Query across relation bounds using links (aka "join"): queries just got much more powerful. For example, query for orders that have a customer with an address on "Sesame Street". Or all persons, who have a grand parent called "Alice".

  • Backlinks for to-many relations: now ObjectBox is "relation complete" with a bi-directional many-to-many relation.

  • Query performance improvements: getting min/max values of indexed properties in constant time

  • Android: added Paging library support (architecture components)

  • Kotlin extensions: more Kotlin fun with ObjectBox KTX

  • Query parameters aliases: helps setting query parameters in complex scenarios (e.g. for properties of linked entities)

  • Improved query parameter verification

  • Many internal improvements to keep us going fast in the future

V1.5 and earlier

Check the release history for older releases