I've got a Game object that includes two PlayerGameState objects. Both
are persistence-capable. My query fetches all PlayerGameState objects
for a particular user, then I get the associated game and other
player. The initial fetch is always fast, and the entire operation is
generally lass than a second. But periodically, maybe 5 of the time,
it takes much longer, from 5-20 seconds. It's not fetching the
PlayerGameState objects that's slow, it's accessing
PlagerGameState.game and Game.playerStates.
I shouldn't need to add an index on the keys, should I? I'd like to
fetch the Game objects directly but as far as I can tell we can't
query on a joined table; ie, I can't do something like "select from
Game, PlayerGameState join on PlayerGameState.game where
PlayerGameState.userKey == userKeyParam".
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Game {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent(mappedBy = "game")
@Element(dependent = "true")
private List<PlayerGameState> playerStates;
...
}
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class PlayerGameState {
@SuppressWarnings("unused")
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private Key userKey;
@Persistent
private Game game;
...
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.