Skip to content

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

Closed
@nzhenry

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());

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