Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7768619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:57:33+00:00 2026-06-01T15:57:33+00:00

I am using objectify 3.1 on appengine and attempting to do a ancestor query.

  • 0

I am using objectify 3.1 on appengine and attempting to do a ancestor query. I want to fetch all the children of an object that are of a certain kind. Below is my code:

@Cached
@Entity
public class Car {

 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;

 private String make;
 private String model;

}

@Cached
@Entity
public class Tire {

@Id
public String keyName; 


@Parent Key<Car> car;

private String brand;
private String size;

}

My query is this code:

        List<Tire> list= ofy.query(Tire.class).ancestor(new    Key<Car(Car.class,carID))).list();

When I create the tire objects I use this code to set the relationship:

        newTire.setCar(new Key<Car>(Car.class,Car.getID()));

I know the Parent relationship is there because I can query for it in the datastore admin and it shows the parent in the decoded entity key:

Decoded entity key: Car: id=135172 > Tire: name=myCarUniqueID

This query always returns 0 results, and it seems like I have followed all the best practices on the objectify website. Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:57:35+00:00Added an answer on June 1, 2026 at 3:57 pm

    Your code looks ok, so the only thing that might be wrong is a non-existing carID.

    The Objectify javadoc listed on the site is actually for trunk version which is a forthcoming Objectify 4. What you need to look at is Objectify 3.1 javadoc: this version has fetch() on the query.

    Also, @GeneratedValue is not an Objectify annotation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using objectify on appengine with the java runtime. I am also using
I'm using objectify's @Cached annotations on my entities. Obviously, this means that any time
I want to recognize uppercase letters using objective-c. I have an implementation now that
I have one entity object (kind) for storing all information from user's advertisement. It
I'm using Objectify to store items in a database, and want to enforce uniqueness
I have been using objective-C to develop in iOS. Now we want to develop
I'm using GAE/Java with Objectify, and I'm trying to find the fastest way to
I've got a Android AppEngine Connected Project I'm trying to build using GWT2.4 RequestFactory
I'm thinking of implementing Objectify DAO with dependency injection, such that I can maintain
I'm using the bulk loader to download my Review kind from one GAE server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.