Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Cloud Datastore Java SDK - parent keys are created without the correct database ID #1456

Description

@nzhenry

Environment details

Java version: 17
SDK version: 2.19.4-SNAPSHOT

Steps to reproduce

  1. Create a key with a parent and a non-default database ID
  2. Compare the database ID of the key to the database ID of the parent
  3. Observe the values are different. They should be the same.

Code example

Key entityKey = DatastoreOptions.newBuilder()
        .setDatabaseId("my-database-id")
        .build()
        .getService()
        .newKeyFactory()
        .setKind("EntityKind")
        .addAncestor(PathElement.of("ParentKind", 1L))
        .newKey(2L);
System.out.printf("Entity database ID: %s%n", entityKey.getDatabaseId());
System.out.printf("Parent database ID: %s%n", entityKey.getParent().getDatabaseId());

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: datastoreIssues related to the googleapis/java-datastore API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions