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 6755761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:26:29+00:00 2026-05-26T13:26:29+00:00

Really like objectify, although still struggling with what is the best way to structure

  • 0

Really like objectify, although still struggling with what is the best way to structure my data in my app. I will be launching a new app soon and do not want to get stuck with a structure that may not function right, or would perform very slowly.

The app will be on the HRD and will have a large number of entity types. For illustrative purposes I will make up some example entities. Suppose the app is for fast food restaurants. Each chain will be an entity(for example McDonalds, Wendy’s, etc.). Each specific franchise or location will be an entity as well. Employees, Orders, Menus, Timesheets, and so on will also be entities.

I guess by biggest question is how to setup the relationships between these entities? I have been store relationships by storing the datastore ID as a long in each entity. For example each employee entity would have a long value that is the datastore ID for the location they work at, as well as for which chain they are a member of.

With this structure I can query for all of the orders from a specific restaurant with a statement such as:

  Long restaurantId =restaurant.getId();
  Query<Order> q=ofy.query(Order.class).filter("location", resturantId);

Just curious if there is any issue with using the datastore/objectify in this manner. Any input would be great! I have been using something similar on a small scale and seems to work fine. Ideally I would like the most efficient structure, and i realize this may take some testing. However once may app is deployed it may be very difficult to change…

@Entity
public class Chain {

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

  private String name;
  private String type;

  //getters & setters, etc
  }

@Entity
public class Location {

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

  private Long chain;  //which resturant chain the location belongs to (mcdonalds, wendy's,     etc)

  private String address;
  private String owner;
  private String phoneNumber;

  //getters & setters, etc
  }

@Entity
public class Employee {

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

  private Long location;  //which location the employee works for
  private Long chain;  //which resturant chain the location belongs to (mcdonalds, wendy's,     etc)

  private String name;
  private String position;

  //getters & setters, etc
  }

@Entity
public class Order {

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

  private Long chain;  //which resturant chain the location belongs to (mcdonalds, wendy's,     etc)
  private Long location;
  private Long employee; //employee that took order

  private Order order;
  private String time;

   //getters & setters, etc
   }
  • 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-26T13:26:30+00:00Added an answer on May 26, 2026 at 1:26 pm

    This is standard practice. Go forth!

    Objectify is great – we’ve been using it for about 6 months and we’re very happy with it.

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

Sidebar

Related Questions

I really like Xml for saving data, but when does sqlite/database become the better
I really like the way gmail has the archive system implemented. I can archive
I really like the MVC way and have actually enjoyed learning ASP.NET MVC (I
I really like DevX components, but they are pretty expensive, maybe anyone knows free
I really like the fact that Microsoft has taken a commitment to bring MVC
I really like how Consolas looks with ClearType enabled but unfortunately it makes everything
I really like the format and type of links from RubyFlow for Ruby related
I really like the Mako templating system that's used in Pylons and a couple
I really like the moq mocking framework. I've used it on several projects. Unfortunately,
I really like the IIS7 URL rewriting module and so far, it worked great

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.