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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:37:53+00:00 2026-06-06T19:37:53+00:00

I’m using Google App Engine and Objectify 3.1 and slowly learning about denormalization and

  • 0

I’m using Google App Engine and Objectify 3.1 and slowly learning about denormalization and designing entities based on their usage, but I’m still struggling with some aspects.

I’m currently building a system in which a User entity can participate in a Game entity and need to be able to find all games a user participates in. The way I see it, there’s two basic solutions:

Solution 1)

Store a list of user keys (participantKeys) on the game and find the games a member participates in like this:

List<Key<User>> userList = new ArrayList<Key<User>>();
userList.add(new Key<User>(User.class, myUserId));
Collection<Game> games = ofy().query(Game.class).filter("participantKeys in" , userList).list();

Solution 2)

In addition to storing a participant list on the game entity, also store a list of games the user has participated in on the user entity and find the games like this:

User myUser = userDao.getUser(myUserId);
Collection<Game> games = user.getParticipatedGameKeys();

Solution 1 would become pretty slow once there’s a lot of games in the system.

Solution 2 would make finding the games faster, but I’ll need to constantly keep the list updated as users join and leave games.

The list of games would also become large once a user has been using the system for a long time. I only want to return all games the user is currently participating in, so that would require traversing the list and excluding “historical” games.

Am I missing a more elegant solution? Neither of the above seem very attractive.

Any and all help is greatly appreciated!

Edit:

I decided to try something like Mikl suggested after thinking about alternatives for a long time.. so it’s good to hear a solution that’s very pretty much exactly like it 🙂

I have created a GameParticipation entity which contains a link to the game, a link to the user and all other information that I need to be able to get.

Every time a game is joined, I update the GameParticipation entity to reflect the current state of the game. When a game is left, I delete the entity. Also, when a game is changed, I update all related GameParticipation entities.

I’ve done a little performance testing and it seems to work reasonably well!

  • 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-06T19:37:54+00:00Added an answer on June 6, 2026 at 7:37 pm

    you can also have an another entity I don’t know how you can call it (UserGame?) , but in this entity you will store the game key, the user key and also some information you want to access to, for instance the user name, the game name and so on. Then when the user enter a game you will create this entity.

    With this entity you can easily retrieve the games a member participates in and also all the users that partipate to a game.

    The inconvenient with this method is that, if a user property or a game property change you need to update also the information you stored in the USerGame entity like the userName.

    I don’t know if it’s a good solution but it should work.

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.