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

  • Home
  • SEARCH
  • 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 946651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:57:13+00:00 2026-05-15T22:57:13+00:00

I have a data model where I’m not sure if I’ll get any benefit

  • 0

I have a data model where I’m not sure if I’ll get any benefit from nesting classes in entity groups. The basic model is that User owns many horses, a horse can only own one saddle:

// Model 1, nest everything:
User
    Horse
        Saddle
    Horse
        Saddle

// Model 2: Just let them all be siblings.
User
    Horse
    Horse
    Saddle
    Saddle

I’m not sure if I gain any advantage over nesting saddle instances under a horse, or if I should just leave them all as siblings.

Generating keys:

// Model 1:
Key key = new KeyFactory.Builder(
  User.class.getSimpleName(), userid)
    .addChild(Horse.class.getSimpleName(), horseid)
      .addChild(Saddle.class.getSimpleName(), saddleid).getKey();

// Model 2:
Key key = new KeyFactory.Builder(
  User.class.getSimpleName(), userid)
    .addChild(Saddle.class.getSimpleName(), saddleid).getKey();

So generating keys is more work for situation 1, and I’m wondering if I should just switch to situation 2 instead, if I’m not gaining any advantage over the additional nesting? The operations I have to do:

  1. Delete a horse and its saddle.
  2. Create a horse with a saddle.
  3. Update a horse and its saddle.
  4. Get a horse by itself.
  5. Get a horse and its saddle at the same time.

Both models give me all the above, I think. Maybe model #1 offers the advantage that the entire User object doesn’t have to be locked when performing operations only on a Saddle?

Thanks

  • 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-05-15T22:57:13+00:00Added an answer on May 15, 2026 at 10:57 pm

    Per the docs:

    Every entity with a given root entity
    as an ancestor is in the same entity
    group. All entities in a group are
    stored in the same datastore node.

    And:

    Only use entity groups when they are
    needed for transactions. For other
    relationships between entities, use
    ReferenceProperty properties and Key
    values, which can be used in queries.

    Both of your models will result in one entity group per user, regardless of nesting. If you just want to represent a hierarchy of objects, you should avoid entity groups entirely and use a ReferenceProperty.

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

Sidebar

Related Questions

i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from
In my Core Data managed object model, I have an entity Foo with a
I have data model classes that contain private fields which are meant to be
I have an entity model which has some tables added from my DB. I
I have a data model that includes common columns like addedBy, editedby (user), addedDate,
My Techie Bretheren (and Sisteren, of course!), I have a LinqToSql data model that
I have a relationship in a Core Data model that feels like it wants
I have a problem. Imagine this data model: [Person] table has: PersonId, Name1 [Tag]
I have some configuration data that I'd like to model in code as so:
If I have the following: {hdrs: [Make,Model,Year], data : [ {Make:Honda,Model:Accord,Year:2008} {Make:Toyota,Model:Corolla,Year:2008} {Make:Honda,Model:Pilot,Year:2008}] }

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.