Skip to content

Update java-server to Ditto SDK 5.0.0 GA#294

Open
Brian Plattenburg (bplattenburg) wants to merge 2 commits into
mainfrom
bp/java-server-sdk-5.0.0
Open

Update java-server to Ditto SDK 5.0.0 GA#294
Brian Plattenburg (bplattenburg) wants to merge 2 commits into
mainfrom
bp/java-server-sdk-5.0.0

Conversation

@bplattenburg
Copy link
Copy Markdown
Member

Bumps com.ditto:ditto-java and com.ditto:ditto-binaries from 5.0.0-java to 5.0.0 GA.

5.0.0 dropped two convenience surfaces that this app was using:

  • ditto.startSync() / ditto.stopSync() removed — use ditto.getSync().start() / .stop() instead.
  • DittoStore.execute(...) now returns CompletionStage<Void> (fire-and-forget). For SELECTs that need a DittoQueryResult, use executeRaw(...). INSERT/UPDATE call sites that ignored the result are unchanged in behavior.

Also fixes the README API reference link, which still pointed at v4.11.

Verified locally: ./gradlew check passes (compile + PMD + SpotBugs).

Bumps com.ditto:ditto-java and com.ditto:ditto-binaries from 5.0.0-java
to 5.0.0 GA.

The 5.0.0 GA removed the convenience sync methods and the result-bearing
form of DittoStore.execute(), so:

- ditto.startSync() / stopSync() are now ditto.getSync().start() / stop().
- DittoStore.execute(...) returns CompletionStage<Void> for fire-and-forget
  writes. To get a DittoQueryResult back for SELECTs, use executeRaw(...).
  Updated the two SELECT call sites; INSERT/UPDATE call sites that ignored
  the result are unchanged in behavior.

Also updates the README API reference link from the stale v4.11 URL to
5.0.0.

Verified locally: ./gradlew check passes (compile + PMD + SpotBugs).
Copilot AI review requested due to automatic review settings May 28, 2026 00:46
Brian Plattenburg (bplattenburg) added a commit that referenced this pull request May 28, 2026
Mirrors the same SDK bump being proposed against main (PR #294). 5.0.0 GA
removes the convenience sync methods and the result-bearing form of
DittoStore.execute(), so:

- ditto.startSync() / stopSync() → ditto.getSync().start() / .stop()
- DittoStore.execute(...) returns CompletionStage<Void>. For SELECTs that
  need a DittoQueryResult back, use executeRaw(...).

Also fixes the README API reference link (was still pointing at v4.11).

Verified locally: ./gradlew check passes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Java server quickstart to Ditto SDK 5.0.0 GA and adapts the code to SDK API changes (sync start/stop API, and DQL execution API changes for SELECT queries).

Changes:

  • Bump com.ditto:ditto-java / com.ditto:ditto-binaries from 5.0.0-java to 5.0.0.
  • Migrate sync controls from ditto.startSync()/stopSync() to ditto.getSync().start()/stop().
  • Switch SELECT call sites from execute(...) to executeRaw(...) and update the README API reference link.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
java-server/src/main/java/com/ditto/example/spring/quickstart/service/DittoTaskService.java Updates SELECT query execution to executeRaw(...) for Ditto v5 GA.
java-server/src/main/java/com/ditto/example/spring/quickstart/service/DittoService.java Updates sync start/stop usage and SELECT query execution to executeRaw(...); aligns with new execute(...) return type.
java-server/README.md Updates API reference link to Ditto Java SDK 5.0.0.
java-server/build.gradle.kts Bumps Ditto Java dependencies to 5.0.0 GA.
Comments suppressed due to low confidence (1)

java-server/src/main/java/com/ditto/example/spring/quickstart/service/DittoTaskService.java:56

  • toggleTaskDone assumes the SELECT returns at least one row (tasks.getItems().get(0)), which will throw IndexOutOfBoundsException if an invalid/nonexistent taskId is posted to /tasks/{taskId}/toggle. Handle the empty result case explicitly (e.g., no-op, return 404/IllegalArgumentException, or similar) before accessing the first item.
            DittoQueryResult tasks = dittoService.getDitto().getStore().executeRaw(
                    "SELECT * FROM %s WHERE _id = :taskId".formatted(TASKS_COLLECTION_NAME),
                    DittoCborSerializable.Dictionary.buildDictionary()
                            .put("taskId", taskId)
                            .build()
            ).toCompletableFuture().join();

            boolean isDone = tasks.getItems().get(0).getValue().get("done").asBoolean();


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Brian Plattenburg (bplattenburg) added a commit that referenced this pull request May 28, 2026
Mirrors the cleanup pattern from PR #294 (java-server) in the offline
branch. Drops the explicit websocketURLs assignment (v5's
serverConnect() handles cloud sync transport) and the LAN re-defaults
(LAN + mDNS are on by default in v5). Keeps the BLE/AWDL disables
because those are intentional macOS unsigned-dev-build workarounds, not
v4 leftovers.

env.ts: drops the now-unused websocketUrl field and removes it from the
online-mode missing-env-var check.

Done on this branch only to slim CVS's evaluation path; broader cleanup
across the other v5 apps is tracked in SDKS-3859.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants