GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Need an easy way to contruct a Key with parent · Issue #1003 · googleapis/google-cloud-java

Need an easy way to contruct a Key with parent #1003

New issue
Copy link
New issue
Copy link
Closed
Closed
Need an easy way to contruct a Key with parent#1003
Copy link
Assignees
mziccard
Labels
api: datastoreIssues related to the Datastore API.

Description

@seymores
seymores
opened on May 12, 2016
Issue body actions

Maybe I missed some docs but I can't figure out how to construct a key with parent. Definitely need an example on how to do this.
I'm using version 0.2.1.

Activity

  1. ajkannan commented on May 12, 2016

    @ajkannan
    ajkannan
    on May 12, 2016
    More actions

    Hi @seymores, this Cloud Datastore docs page has some text and a short example on creating a key with a parent.

  2. mziccard
    added
    api: datastoreIssues related to the Datastore API.
    on May 12, 2016
  3. ajkannan commented on May 12, 2016

    @ajkannan
    ajkannan
    on May 12, 2016
    More actions

    In addition to the example in the above link (which uses PathElement), gcloud-java also has a shorthand for adding a parent (see the methods 2nd and 3rd from the bottom in Key's API docs page). For example, if you have a parent myParentKey of type Key, you can use something like:

    Key childKey = Key.builder(myParentKey, "ChildKeyKind", "ChildKeyName").build();
    
  4. volgin commented on May 16, 2016

    @volgin
    volgin
    on May 16, 2016
    More actions

    For anyone else looking at this issue:

    Key key = datastore.newKeyFactory()
            .projectId(PROJECT)
            .kind(ENTITY_KIND)
            .ancestors(PathElement.of(PARENT_KIND, PARENT_ID))
            .newKey(ID_OR_NAME);
    
    Reacted by Teo Choong Ping
  5. mziccard commented on May 18, 2016

    @mziccard
    mziccard
    on May 18, 2016
    Contributor
    More actions

    Closing this as both @ajkannan and @volgin answered. Thanks guys.

  6. mziccard
    closed this as completedon May 18, 2016
  7. JustinBeckwith
    assigned
    mziccard
    on Feb 1, 2021
  8. github-actions
    added 2 commits that reference this issue on Aug 9, 2022

    deps: update dependency com.google.api.grpc:proto-google-cloud-aiplat…

    b793732

    chore(main): release 3.2.0 (#1017)

    722238d
  9. github-actions
    added 2 commits that reference this issue on Oct 4, 2022

    chore(main): release 2.2.10 (#1003)

    8bf17d7

    chore(main): release 0.124.16-SNAPSHOT (#1003)

    7176f26
  10. suztomo
    added 2 commits that reference this issue on Feb 1, 2023

    deps: update dependency org.threeten:threetenbp to v1.6.4 (#1003)

    b55cde7

    chore(main): release 2.8.25 (#1002)

    a6c367a
  11. chingor13
    added a commit that references this issue on Jan 6, 2026

    deps: update dependency com.google.cloud:google-cloud-logging to v3.1…

    143eb6a
  12. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore(main): release 2.13.6 (#1003)

    d1f4462
  13. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore: pin versions of dependencies for compatibility with Python 3.6 (…

    2ab9320
  14. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore: pin versions of dependencies for compatibility with Python 3.6 (…

    8cfdecc
  15. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(main): release 2.7.9-SNAPSHOT (googleapis#1003)

    43c2d9d
  16. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore(main): release 1.115.4-SNAPSHOT (#1003)

    31a9010

    chore(main): release 1.115.4-SNAPSHOT (#1003)

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

Metadata

Metadata

Assignees

  • @mziccard
    mziccard

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.