Skip to content

Releases: objectbox/objectbox-java

V3.0.0

19 Oct 12:45

Choose a tag to compare

Note: this version contains a bug that prevents usage with Android Java only projects. Use 3.0.1 instead.

  • A new Query API is available that works similar to the ObjectBox for Dart/Flutter Query API and makes it easier to create nested conditions. #201
    // equal AND (less OR oneOf)
    val query = box.query(
          User_.firstName equal "Joe"
                  and (User_.age less 12
                  or (User_.stamp oneOf longArrayOf(1012))))
          .order(User_.age)
          .build()
  • For the existing Query API, String property conditions now require to explicitly specify case. See the documentation of StringOrder for which one to choose (typically StringOrder.CASE_INSENSITIVE).
    // Replace String conditions like
    query().equal(User_.firstName, "Joe")
    // With the one accepting a StringOrder
    query().equal(User_.firstName, "Joe", StringOrder.CASE_INSENSITIVE)
  • The Gradle plugin will now warn when an @Entity class is missing a no-arg (easy to add) or all properties (best for performance) constructor. #900
    Example for an all properties constructor:
    @Entity
    public class Order {
    
        @Id
        private long id;
        private ToOne<Customer> customer;
        private ToMany<Order> relatedOrders;
    
        // All properties constructor for ObjectBox:
        // - make sure type matches exactly,
        // - for ToOne add its virtual ID property instead,
        // - for ToMany add no parameter.
        public Order(long id, long customerId) {
            this.id = id;
            this.customer.setTargetId(customerId);
        }
    
        // TODO getters and setters for properties
    }
  • Subscriptions now publish results in serial instead of in parallel (using a single thread vs. multiple threads per publisher). Publishing in parallel could previously lead to outdated results getting delivered after the latest results. As a side-effect transformers now run in serial instead of in parallel as well (on the same single thread per publisher). #793
  • Support annotating a single property with @Unique(onConflict = ConflictStrategy.REPLACE) to replace an existing Object if a conflict occurs when doing a put. #509
    @Entity
    data class Example(
            @Id
            var id: Long = 0,
            @Unique(onConflict = ConflictStrategy.REPLACE)
            var uniqueKey: String? = null
    )
  • Support @Unsigned to indicate that values of an integer property (e.g. Integer and Long in Java) should be treated as unsigned when doing queries or creating indexes.
  • Store time in nanoseconds using the new @Type annotation:
    @Type(DatabaseType.DateNano)
    var timeInNanos: Long;
  • Package FlatBuffers version into library to avoid conflicts with apps or other libraries using FlatBuffers. #894
  • Kotlin: add Flow extension functions for BoxStore and Query. #990
  • Data browser: display query results if a property has a NaN value. #984
  • Android 12: support using Data Browser if targeting Android 12 (SDK 31). #1007

New supported property types

  • String arrays (Java String[] and Kotlin Array<String>) and lists (Java List<String> and Kotlin MutableList<String>). Using the new containsElement("item") condition, it is also possible to query for entities where "item" is equal to one of the elements.
    @Entity
    data class Example(
            @Id
            var id: Long = 0,
            var stringArray: Array<String>? = null,
            var stringMap: MutableMap<String, String>? = null
    )
    
    // matches [“first”, “second”, “third”]
    box.query(Example_.stringArray.containsElement(“second”)).build()
  • String maps (Java Map<String, String> or Kotlin MutableMap<String, String>). Stored internally as a byte array using FlexBuffers.
  • Flexible maps:
    • map keys must all have the same type,
    • map keys or values must not be null,
    • map values must be one of the supported database type, or a list of them (e.g. String, Boolean, Integer, Double, byte array...).

Sync

  • The generated JSON model file no longer contains Java-specific flags that would lead to errors if used with Sync server.
  • Additional checks when calling client or server methods.

All release notes & docs

V2.9.1

16 Mar 14:50

Choose a tag to compare

This is the first release available on the Central repository (Sonatype OSSRH). Make sure to adjust your build.gradle files accordingly:

repositories {
    mavenCentral()
}

Changes:

  • Javadoc for find(offset, limit) of Query is more concrete on how offset and limit work.
  • Javadoc for between conditions explicitly mentions it is inclusive of the two given values.
  • Sync: Instead of the same name and a Maven classifier, Sync artifacts now use a different name. E.g. objectbox-android:2.9.0:sync is replaced with objectbox-sync-android:2.9.1.

All release notes & docs

V2.9.0

22 Feb 13:03

Choose a tag to compare

  • Query: Add lessOrEqual and greaterOrEqual conditions for long, String, double and byte[] properties.
  • Support Java applications on ARMv7 and AArch64 devices. #657
    To use, add implementation "io.objectbox:objectbox-linux-armv7:$objectboxVersion or implementation "io.objectbox:objectbox-linux-arm64:$objectboxVersion to your dependencies. Otherwise the setup is identical with Java Desktop Apps.
  • Resolve rare ClassNotFoundException: kotlin.text.Charsets when running processor. #946
  • Ensure Query setParameters works if running the x86 library on x64 devices (which could happen if ABI filters were set up incorrectly). #927

Previous release notes & docs

V2.8.1

23 Nov 08:54

Choose a tag to compare

  • Minor improvements to Sync tooling.

See the 2.8.0 release notes for the latest changes.

Previous release notes

V2.8.0

23 Nov 08:52

Choose a tag to compare

  • Added Sync API.
  • Fixed "illegal reflective access" warning in the plugin.
  • The data browser notification is now silent by default, for quieter testing. #903
  • Updated and improved API documentation in various places (e.g. on how Query.findLazy() and Query.findLazyCached() work with LazyList #906).
  • Print full name and link to element for @Index and @Id errors. #902
  • Explicitly allow to remove a DbExceptionListener by accepting null values for BoxStore.setDbExceptionListener(listener).

Previous release notes

V2.7.1

24 Aug 13:05

Choose a tag to compare

  • Fix exception handling during BoxStoreBuilder.build() to allow retries. For example, after a FileCorruptException you could try to open the database again using the recently added usePreviousCommit() option.
  • Add PagesCorruptException as a special case of FileCorruptException.
  • DbExceptionListener is called more robustly.

Previous release notes

V2.7.0

03 Aug 12:46

Choose a tag to compare

  • Several database store improvements for BoxStore and BoxStoreBuilder
    • New configuration options to open the database, e.g. a new read-only mode and using the previous data snapshot (second last commit) to potentially recover data.
    • Database validation. We got a GitHub report indicating that some specific devices ship with a broken file system. While this is not a general concern (file systems should not be broken), we decided to detect some typical problems and provide some options to deal with these.
    • Get the size on disk
  • Add an efficient check if an object exist in a Box via contains(id).
  • Android improvements
    • Resolve Android Studio Build Analyzer warning about a prepare tasks not specifying outputs.
    • Data Browser drawables are no longer packaged in the regular Android library. #857
  • Fixes for one-to-many relations, e.g. allow removing both entity classes of a one-to-many relation. #859

See also https://docs.objectbox.io/

V2.6.0

30 Jun 10:29

Choose a tag to compare

  • @DefaultValue("") annotation. Annotated properties will return the specified default value (currently only "" is supported) instead of null. This is useful if a not-null property is added to an entity, but there are existing entities in the database that will return null for the new property.
    Note: naming is not final, it may change to e.g. @AbsentValue(""). #157
  • RxJava 3 support library objectbox-rxjava3. Also includes Kotlin extension functions to more easily obtain Rx types, e.g. use query.observable() to get an Observable. #83
  • The annotation processor is incremental by default. #620
  • Fix error handling if ObjectBox can't create a Java entity (the proper exception is now thrown).
  • Support setting an alias after combining conditions using and() or or(). #83
  • Add documentation that string property conditions ignore case by default. Point to using case-sensitive conditions for high-performance look-ups, e.g. when using string UIDs.
  • Repository Artifacts are signed once again.

Changes since 2.6.0-RC (released on 2020/04/28):

  • Performance improvements with query links (aka "joins").
    Note: the order of results has changed unless you explicitly specified properties to order by. Remember: you should not depend on any internal order. If you did, this is a good time to fix it.
  • objectbox-java no longer exposes the greenrobot-essentials and FlatBuffers dependencies to consuming projects.
  • Minor code improvements.

See the full changelog for more details.

V2.6.0-RC

04 May 06:48

Choose a tag to compare

V3.0.0-alpha2

24 Mar 13:59

Choose a tag to compare

V3.0.0-alpha2 Pre-release
Pre-release

Note: this is a preview release. Future releases may add, change or remove APIs.

  • Add Kotlin infix extension functions for creating conditions using the new Query API. See the documentation for examples.
  • The old Query API now also supports setting an alias after combining conditions using and() or or(). #834
  • Add documentation that string property conditions ignore case by default. Point to using case-sensitive conditions for high-performance look-ups, e.g. when using string UIDs.
  • Java's String[] and Kotlin's Array<String> are now a supported database type. A converter is no longer necessary to store these types. Using the arrayProperty.equal("item") condition, it is possible to query for entities where "item" is equal to one of the array items.
  • Support @Unsigned to indicate that values of an integer property (e.g. Integer and Long in Java) should be treated as unsigned when doing queries or creating indexes. See the Javadoc of the annotation for more details.
  • Support marking 64-bit integer properties (e.g. Long in Java) with @Type(DateNano) to indicate the database should treat these values as time with nanosecond precision. Note: to store time in millisecond precision continue to use java.util.Date (without annotation). This is not ready, yet.
  • Add new library to support RxJava 3, objectbox-rxjava3. In addition, objectbox-kotlin adds extension functions to more easily obtain Rx types, e.g. use query.observable() to get an Observable. #839

To use this release change the version of objectbox-gradle-plugin to 3.0.0-alpha2. The plugin now properly adds the preview version of objectbox-java to your dependencies.

buildscript {
    dependencies {
        classpath "io.objectbox:objectbox-gradle-plugin:3.0.0-alpha2"
    }
}

dependencies {
    // Artifacts with native code remain at 2.5.1.
    implementation "io.objectbox:objectbox-android:2.5.1"
}

The objectbox-android, objectbox-linux, objectbox-macos and objectbox-windows artifacts shipping native code remain at version 2.5.1 as there have been no changes. If you explicitly include them, make sure to specify their version as 2.5.1.