Releases: objectbox/objectbox-java
Releases · objectbox/objectbox-java
V3.1.2
This release only contains bug fixes for the Android library when used with ObjectBox for Dart/Flutter.
V3.1.1
This release only contains bug fixes.
- Fix incorrect unique constraint violation if an entity contains at least two unique properties with a certain combination of non-unique indexes.
- Data Browser/Admin: improved support when running multiple on the same host, but a different port (e.g.
localhost:8090andlocalhost:8091).
V3.1.0
Read the blog post with more details and code examples for the new flex properties and query conditions.
- Support Flex properties. Expanding on the string and flexible map support in
3.0.0, it is now possible to add a property usingObjectin Java orAny?in Kotlin. These "flex properties" now allow to store values of various types like integers, floating point values, strings and byte arrays. Or lists and maps (using string keys) of those. Some limitations apply, see theFlexObjectConverterclass documentation for details.@Entity data class Customer( @Id var id: Long = 0, var tag: Any? = null ) val customerStrTag = Customer(tag = "string-tag") val customerIntTag = Customer(tag = 1234) box.put(customerStrTag, customerIntTag)
- The
containsElementquery condition now matches keys of string map properties. It also matches string or integer elements of a Flex list. - New
containsKeyValuequery condition to match key/value combinations of string map and Flex map properties containing strings and integers. Also added matchingQuery.setParametersoverload.val customer = Customer( properties = mutableMapOf("premium" to "tier-1") ) box.put(customer) // Query for any customers that have a premium key in their properties map val queryPremiumAll = box.query( Customer_.properties.containsElement("premium") ).build() // Match only customers with specific key and value map entry val queryPremiumTier1 = box.query( Customer_.properties.containsKeyValue("premium", "tier-1") ).build()
- Add ProGuard/R8 rule to not warn about
SuppressFBWarningsannotation. #1011 - Add more detailed error message when loading the native library fails on Android. #1024
- Data browser: byte arrays are now correctly displayed in Base64 encoding. #1033
Kotlin
- Add
BoxStore.awaitCallInTxsuspend function which wrapsBoxStore.callInTx.
Gradle plugin
- Do not crash trying to add dependencies to Java desktop projects that only apply the Gradle
applicationplugin.
V3.0.1
- Fixes the ObjectBox plugin crashing when applied to an Android project that does not use the Kotlin plugin.
See the 3.0.0 release notes for a list of important changes.
V3.0.0
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
StringOrderfor which one to choose (typicallyStringOrder.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
@Entityclass 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
@Unsignedto indicate that values of an integer property (e.g.IntegerandLongin Java) should be treated as unsigned when doing queries or creating indexes. - Store time in nanoseconds using the new
@Typeannotation:@Type(DatabaseType.DateNano) var timeInNanos: Long;
- Package FlatBuffers version into library to avoid conflicts with apps or other libraries using FlatBuffers. #894
- Kotlin: add
Flowextension functions forBoxStoreandQuery. #990 - Data browser: display query results if a property has a
NaNvalue. #984 - Android 12: support using Data Browser if targeting Android 12 (SDK 31). #1007
New supported property types
- String arrays (Java
String[]and KotlinArray<String>) and lists (JavaList<String>and KotlinMutableList<String>). Using the newcontainsElement("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 KotlinMutableMap<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.
V2.9.1
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)ofQueryis 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:syncis replaced withobjectbox-sync-android:2.9.1.
V2.9.0
- Query: Add
lessOrEqualandgreaterOrEqualconditions for long, String, double and byte[] properties. - Support Java applications on ARMv7 and AArch64 devices. #657
To use, addimplementation "io.objectbox:objectbox-linux-armv7:$objectboxVersionorimplementation "io.objectbox:objectbox-linux-arm64:$objectboxVersionto your dependencies. Otherwise the setup is identical with Java Desktop Apps. - Resolve rare
ClassNotFoundException: kotlin.text.Charsetswhen 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
V2.8.1
- Minor improvements to Sync tooling.
See the 2.8.0 release notes for the latest changes.
V2.8.0
- 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()andQuery.findLazyCached()work withLazyList#906). - Print full name and link to element for
@Indexand@Iderrors. #902 - Explicitly allow to remove a
DbExceptionListenerby accepting null values forBoxStore.setDbExceptionListener(listener).
V2.7.1
- Fix exception handling during
BoxStoreBuilder.build()to allow retries. For example, after aFileCorruptExceptionyou could try to open the database again using the recently addedusePreviousCommit()option. - Add
PagesCorruptExceptionas a special case ofFileCorruptException. DbExceptionListeneris called more robustly.