Hi,
Is there a way to merge multiple trips to the datastore into one trip? I have something like this:
class User {
@PrimaryKey
private String mUsername;
}
class Horse {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;
@Persistent
private String mOwnerUsername;
}
class Cow {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;
@Persistent
private String mOwnerUsername;
}
A User can own many Horses or Cows. Right now to get all of a user's horses and cows, I'm making three separate trips to the datastore with three separate queries, something like:
User user = select from Users where userid = 'abc';
List<Horse> horses = select from Horses where ownerUsername = 'abc';
List<Cow> cows = select from Cows where ownerUsername = 'abc';
is there a way to collapse those three into a single trip to the datastore? I don't want to make the horses and cows members of the User class, because there may be a huge number of them, and don't want to load them on every load of User. Also a User does not have sole ownership of a horse or cow, they can be owned by many different entities.
Thanks