Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nzhenry opened this issue May 27, 2024 · 0 comments · Fixed by #1457
Closed

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

nzhenry opened this issue May 27, 2024 · 0 comments · Fixed by #1457
Labels
api: datastore Issues related to the googleapis/java-datastore API.

Comments

@nzhenry
Copy link
Contributor

nzhenry commented May 27, 2024

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/java-datastore API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant