Skip to content

Commit 1ae98f6

Browse files
Prepare Java release 4.3.0
1 parent 1ffb9a3 commit 1ae98f6

File tree

4 files changed

+108
-49
lines changed

4 files changed

+108
-49
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Notable changes to the ObjectBox Java library.
44

55
For more insights into what changed in the ObjectBox C++ core, [check the ObjectBox C changelog](https://github.com/objectbox/objectbox-c/blob/main/CHANGELOG.md).
66

7-
## 4.2.1 - in development
7+
## 4.3.0 - 2025-05-13
88

99
- Basic support for boolean array properties (`boolean[]` in Java or `BooleanArray` in Kotlin).
1010

README.md

+104-45
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,68 @@ Store and manage data effortlessly in your Android or JVM Linux, macOS or Window
2929
Easily manage vector data alongside your objects and perform superfast on-device vector search to empower your apps with RAG AI, generative AI, and similarity search.
3030
Enjoy exceptional speed, battery-friendly resource usage, and environmentally-friendly development. 💚
3131

32-
## Demo code
32+
ObjectBox provides a store with boxes to put objects into:
33+
34+
#### JVM + Java example
3335

3436
```java
35-
// Java
36-
Playlist playlist = new Playlist("My Favorites");
37-
playlist.songs.add(new Song("Lalala"));
38-
playlist.songs.add(new Song("Lololo"));
39-
box.put(playlist);
37+
// Annotate a class to create a Box
38+
@Entity
39+
public class Person {
40+
private @Id long id;
41+
private String firstName;
42+
private String lastName;
43+
44+
// Constructor, getters and setters left out for simplicity
45+
}
46+
47+
BoxStore store = MyObjectBox.builder()
48+
.name("person-db")
49+
.build();
50+
51+
Box<Person> box = store.boxFor(Person.class);
52+
53+
Person person = new Person("Joe", "Green");
54+
long id = box.put(person); // Create
55+
person = box.get(id); // Read
56+
person.setLastName("Black");
57+
box.put(person); // Update
58+
box.remove(person); // Delete
4059
```
4160

42-
➡️ [More details in the docs](https://docs.objectbox.io/)
61+
#### Android + Kotlin example
4362

4463
```kotlin
45-
// Kotlin
46-
val playlist = Playlist("My Favorites")
47-
playlist.songs.add(Song("Lalala"))
48-
playlist.songs.add(Song("Lololo"))
49-
box.put(playlist)
64+
// Annotate a class to create a Box
65+
@Entity
66+
data class Person(
67+
@Id var id: Long = 0,
68+
var firstName: String? = null,
69+
var lastName: String? = null
70+
)
71+
72+
val store = MyObjectBox.builder()
73+
.androidContext(context)
74+
.build()
75+
76+
val box = store.boxFor(Person::class)
77+
78+
var person = Person(firstName = "Joe", lastName = "Green")
79+
val id = box.put() // Create
80+
person = box.get(id) // Read
81+
person.lastName = "Black"
82+
box.put(person) // Update
83+
box.remove(person) // Delete
5084
```
5185

86+
Continue with the ➡️ **[Getting Started guide](https://docs.objectbox.io/getting-started)**.
87+
5288
## Table of Contents
5389

5490
- [Key Features](#key-features)
5591
- [Getting started](#getting-started)
5692
- [Gradle setup](#gradle-setup)
57-
- [First steps](#first-steps)
93+
- [Maven setup](#maven-setup)
5894
- [Why use ObjectBox?](#why-use-objectbox-for-java-data-management)
5995
- [Community and Support](#community-and-support)
6096
- [Changelog](#changelog)
@@ -73,11 +109,12 @@ box.put(playlist)
73109

74110
### Gradle setup
75111

76-
For Android projects, add the ObjectBox Gradle plugin to your root `build.gradle`:
112+
For Gradle projects, add the ObjectBox Gradle plugin to your root Gradle script:
77113

78-
```groovy
114+
```kotlin
115+
// build.gradle.kts
79116
buildscript {
80-
ext.objectboxVersion = "4.2.0"
117+
val objectboxVersion by extra("4.3.0")
81118
repositories {
82119
mavenCentral()
83120
}
@@ -87,47 +124,69 @@ buildscript {
87124
}
88125
```
89126

90-
And in your app's `build.gradle` apply the plugin:
127+
<details><summary>Using plugins syntax</summary>
91128

92-
```groovy
93-
// Using plugins syntax:
129+
```kotlin
130+
// build.gradle.kts
94131
plugins {
95-
id("io.objectbox") // Add after other plugins.
132+
id("com.android.application") version "8.0.2" apply false // When used in an Android project
133+
id("io.objectbox") version "4.3.0" apply false
96134
}
97-
98-
// Or using the old apply syntax:
99-
apply plugin: "io.objectbox" // Add after other plugins.
100135
```
101136

102-
### First steps
137+
```kotlin
138+
// settings.gradle.kts
139+
pluginManagement {
140+
resolutionStrategy {
141+
eachPlugin {
142+
if (requested.id.id == "io.objectbox") {
143+
useModule("io.objectbox:objectbox-gradle-plugin:${requested.version}")
144+
}
145+
}
146+
}
147+
}
148+
```
103149

104-
Create a data object class `@Entity`, for example "Playlist".
150+
</details>
105151

106-
```kotlin
107-
// Kotlin
108-
@Entity data class Playlist( ... )
152+
<details><summary>Using Groovy syntax</summary>
109153

110-
// Java
111-
@Entity public class Playlist { ... }
154+
```groovy
155+
// build.gradle
156+
buildscript {
157+
ext.objectboxVersion = "4.3.0"
158+
repositories {
159+
mavenCentral()
160+
}
161+
dependencies {
162+
classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
163+
}
164+
}
112165
```
113166

114-
Now build the project to let ObjectBox generate the class `MyObjectBox` for you.
167+
</details>
115168

116-
Prepare the BoxStore object once for your app, e.g. in `onCreate` in your Application class:
169+
And in the Gradle script of your subproject apply the plugin:
117170

118-
```java
119-
boxStore = MyObjectBox.builder().androidContext(this).build();
171+
```kotlin
172+
// app/build.gradle.kts
173+
plugins {
174+
id("com.android.application") // When used in an Android project
175+
kotlin("android") // When used in an Android project
176+
kotlin("kapt")
177+
id("io.objectbox") // Add after other plugins
178+
}
120179
```
121180

122-
Then get a `Box` class for the Playlist entity class:
181+
Then sync the Gradle project with your IDE.
123182

124-
```java
125-
Box<Playlist> box = boxStore.boxFor(Playlist.class);
126-
```
183+
Your project can now use ObjectBox, continue by [defining entity classes](https://docs.objectbox.io/getting-started#define-entity-classes).
184+
185+
### Maven setup
127186

128-
The `Box` object gives you access to all major functions, like `put`, `get`, `remove`, and `query`.
187+
This is currently only supported for JVM projects.
129188

130-
For details please check the [docs](https://docs.objectbox.io).
189+
To set up a Maven project, see the [README of the Java Maven example project](https://github.com/objectbox/objectbox-examples/blob/main/java-main-maven/README.md).
131190

132191
## Why use ObjectBox for Java data management?
133192

@@ -171,7 +230,7 @@ challenges in everyday app development?
171230

172231
- Add [GitHub issues](https://github.com/ObjectBox/objectbox-java/issues)
173232
- Upvote important issues 👍
174-
- Drop us a line via [@ObjectBox_io](https://twitter.com/ObjectBox_io/) or contact[at]objectbox.io
233+
- Drop us a line via contact[at]objectbox.io
175234
- ⭐ us on GitHub if you like what you see!
176235

177236
Thank you! Stay updated with our [blog](https://objectbox.io/blog).
@@ -185,10 +244,10 @@ For notable and important changes in new releases, read the [changelog](CHANGELO
185244
ObjectBox supports multiple platforms and languages.
186245
Besides JVM based languages like Java and Kotlin, ObjectBox also offers:
187246

188-
- [Swift Database](https://github.com/objectbox/objectbox-swift): build fast mobile apps for iOS (and macOS)
189-
- [Dart/Flutter Database](https://github.com/objectbox/objectbox-dart): cross-platform for mobile and desktop apps
190-
- [Go Database](https://github.com/objectbox/objectbox-go): great for data-driven tools and embedded server applications
191-
- [C and C++ Database](https://github.com/objectbox/objectbox-c): native speed with zero copy access to FlatBuffer objects
247+
- [C and C++ SDK](https://github.com/objectbox/objectbox-c): native speed with zero copy access to FlatBuffer objects
248+
- [Dart and Flutter SDK](https://github.com/objectbox/objectbox-dart): cross-platform for mobile and desktop apps
249+
- [Go SDK](https://github.com/objectbox/objectbox-go): great for data-driven tools and embedded server applications
250+
- [Swift SDK](https://github.com/objectbox/objectbox-swift): build fast mobile apps for iOS (and macOS)
192251

193252
## License
194253

build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ plugins {
1313
}
1414

1515
buildscript {
16-
val versionNumber = "4.2.1" // without "-SNAPSHOT", e.g. "2.5.0" or "2.4.0-RC"
17-
val isRelease = false // WARNING: only set true to publish a release on publish branch!
16+
val versionNumber = "4.3.0" // without "-SNAPSHOT", e.g. "2.5.0" or "2.4.0-RC"
17+
val isRelease = true // WARNING: only set true to publish a release on publish branch!
1818
// See the release checklist for details.
1919
// Makes this produce release artifacts, changes dependencies to release versions.
2020

objectbox-java/src/main/java/io/objectbox/BoxStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class BoxStore implements Closeable {
7777
* ReLinker uses this as a suffix for the extracted shared library file. If different, it will update it. Should be
7878
* unique to avoid conflicts.
7979
*/
80-
public static final String JNI_VERSION = "4.2.0-2025-03-04";
80+
public static final String JNI_VERSION = "4.3.0-2025-05-12";
8181

8282
/** The ObjectBox database version this Java library is known to work with. */
8383
private static final String VERSION = "4.3.0-2025-05-12";

0 commit comments

Comments
 (0)